Skip to content

Latest commit

 

History

History
82 lines (82 loc) · 4.2 KB

README.md

File metadata and controls

82 lines (82 loc) · 4.2 KB

AirBnB clone - The console 📂

Description

This proyect is the implementation of an storeg engine, and how to store all the information about users in a json file, control by a console, as the name mentioned this proyect create a console in interactive and non-interactive mode, and it used to create and implement a lot of command to recreate a storeg engine

Serialization-deserialization's flow 📦:

<class 'BaseModel'> -> to_dict() -> <class 'dict'> -> JSON dump -> <class 'str'> -> FILE -> <class 'str'> -> JSON load -> <class 'dict'> -> <class 'BaseModel'>

This is the process of Serialization and deserialization to a json file

Proyect Overview 📊:

How to start it:

AirBnB$ ./console.py """interactive mode"""

(hbnb) help

Documented commands (type help < topic >):


EOF all create destroy help quit show update

(hbnb)

(hbnb) quit

AirBnB$ echo "help" | ./console.py """non-interactive mode""" (hbnb)

Documented commands (type help < topic >):

This is the command's list:

  • help - Shows information about the console or its commands - Usage: help or help create
  • EOF - Exits the console
  • quit - Exits the console
  • create - Creates an instance - Usage: create Class
  • show - Prints the string representation of an instance - Usage: show Class id
  • destroy - Deletes an intance - Usage: destroy Class id
  • all - Prints all string representation of all instance - Usage: all or all Class
  • update - Updates an instance - Usage: update Class id attribute value

Examples:

Create:

(hbnb) create BaseModel

929fab0f-efb4-4eb7-9cfa-27c57cd167df

(hbnb) create User

5aa4eec2-ce66-4415-ba41-28c3207a68b6

(hbnb) create Place

63514b83-af33-4038-9c66-256fefc35165

destroy:

(hbnb) create Place

9fd1f506-9cc7-4ba8-9b2f-d6bda9bbcddb

(hbnb) destroy Place 9fd1f506-9cc7-4ba8-9b2f-d6bda9bbcddb

(hbnb) show Place 9fd1f506-9cc7-4ba8-9b3f-d6bda9bbcddb

** no instance found **

all:

(hbnb) create BaseModel

bf876ce4-ecc9-4185-8d22-88c23cbe4f28

(hbnb) create BaseModel

61691f4f-f58c-4b58-8618-14472c984061

(hbnb) create User

81fc9995-016a-4f47-85ef-62bb73ce5e1c

(hbnb) all

["[BaseModel] (bf876ce4-ecc9-4185-8d22-88c23cbe4f28) {'id': 'bf876ce4-ecc9-4185-8d22-88c23cbe4f28', 'created_at': datetime.datetime(2022, 7, 6, 15, 49, 15, 483376), 'updated_at': datetime.datetime(2022, 7, 6, 15, 49, 15, 483395)}", "[BaseModel] (61691f4f-f58c-4b58-8618-14472c984061) {'id': '61691f4f-f58c-4b58-8618-14472c984061', 'created_at': datetime.datetime(2022, 7, 6, 15, 49, 31, 624055), 'updated_at': datetime.datetime(2022, 7, 6, 15, 49, 31, 624070)}", "[User] (81fc9995-016a-4f47-85ef-62bb73ce5e1c) {'id': '81fc9995-016a-4f47-85ef-62bb73ce5e1c', 'created_at': datetime.datetime(2022, 7, 6, 15, 49, 36, 876947), 'updated_at': datetime.datetime(2022, 7, 6, 15, 49, 36, 877007)}"]