We made this project in order to learn how to recreate the AirBnB website, from the back-end data management to the front-end user interface.
This repo contains the first part of the project which consists in :
- put in place a parent class (called BaseModel) to take care of the initialization, serialization and deserialization of your future instances
- create a simple flow of serialization/deserialization: Instance <-> Dictionary <-> JSON string <-> file
- create all classes used for AirBnB (User, State, City, Place…) that inherit from BaseModel
- create the first abstracted storage engine of the project: File storage
- create all unittests to validate all our classes and storage engine
console.py - is used as the "entry-point" of the command-interpreter, here's the list of available commands:
- EOF - exits the console
- quit - quit the console
- emptyline - emptyline method is here overloaded, in order to do nothing when you press enter
- create - Creates a new instance based on user input
- show - Prints the string representation of an instance, format <classname> <id>
- destroy - Deletes an instance and save modifications on the JSON file
- all - Prints all string representation of all instances based on the class name or not
- update - Updates an instance, based on class name and id provided by user, by adding or updating attributes
yet to be defined...
yet to be defined...
yet to be defined...
You can access the console via two modes.
Interactive mode:
$ ./console.py
Non-interactive mode:
$ echo "<command>" | ./console.py
Standard commands:
./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF all create destroy help quit show update
(hbnb) create BaseModel
014ae95d-91b5-4c85-acc4-8d768482d471
(hbnb) show BaseModel
** instance id missing **
(hbnb) show BaseModel 014ae95d-91b5-4c85-acc4-8d768482d471
[BaseModel] (014ae95d-91b5-4c85-acc4-8d768482d471) {'created_at': datetime.datetime(2022, 10, 13, 5, 14, 44, 854946), 'updated_at': datetime.datetime(2022, 10, 13, 5, 14, 44, 855166), 'id': '014ae95d-91b5-4c85-acc4-8d768482d471'}
yet to be defined...