0x00. AirBnB clone - The console
Welcome to the AirBnB clone project! (The Holberton B&B) Before starting, please read the AirBnB concept page and watch this video from Isaac Wong, Cohort #5, showing what the Console should look like when you are complete with this project.
It is time to develop our AirBnb clone. The goal of the project is to deploy on your server a simple copy of the website. This project must be composed at the end of its development by:
- A command interpreter to manipulate data without a visual interface, like in a Shell (perfect for development and debugging)
- A website (the front-end) that shows the final product to everybody: static and dynamic
- A database or files that store data (data = objects)
- An API that provides a communication interface between the front-end and your data (retrieve, create, delete, update them)
See to the following picture:
AirBnb Clone is a project that consists of several stages linked together, which will be developed step by step:
- The Console
- Web Static
- MySQL storage
- Web framework - templating
- RESTful API
- Web dynamic
And today will start with The Console (a command interpreter to manage your AirBnB objects).
This is the first step towards building your first full web application: the AirBnB clone. This first step is very important because you will use what you build during this project with all other following projects: HTML/CSS templating, database storage, API, front-end integration and others.
- 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 fromBaseModel
- create the first abstracted storage engine of the project: File storage.
- create all unittests to validate all our classes and storage engine
File | File Hierarchy | Description |
---|---|---|
console.py |
console.py | The main console file |
amenity.py |
models/amenity.py | The amenity subclass |
base_model.py |
models/base_model.py | The base model superclass |
city.py |
models/city.py | The city subclass |
place.py |
models/place.py | Te place subclass |
review.py |
models/review.py | Te review subclass |
state.py |
models/state.py | Te state subclass |
user.py |
models/user.py | Te user subclass |
file_storage.py |
models/engine/file_storage.py | The file storage class |
test_amenity.py |
tests/test_amenity.py | The unittest module for amenity |
test_base_model.py |
tests/base_model.py | The unittest module for base model |
test_city.py |
tests/city.py | The unittest module for city |
test_place.py |
tests/place.py | The unittest module for place |
test_review.py |
tests/review.py | The unittest module for review |
test_state.py |
tests/state.py | The unittest module for state |
test_user.py |
tests/user.py | The unittest module for user |
test_file_storage.py |
tests/test_models/test_engine/test_file_storage.py | The unittest module for file storage |
Command | Usage | Example | Functionality |
---|---|---|---|
help |
help |
help | displays a list of the commands |
create |
create <class> |
create BaseModel | Create a new instance |
show |
show <class> <id> |
show BaseModel 787fds-fdf665-fdf843a1 | Shows a specific instance |
destroy |
destroy <class> <id> |
destroy BaseModel 787fds-fdf665-fdf843a1 | Deletes a specific instance |
all |
all or all <class> |
all BaseModel | Shows all instance or class |
update |
update <class> <id> <attribute> <value> |
update BaseModel 787fds-fdf665-fdf843a1 name Maria | Update an attribute in an instance |
quit |
quit |
quit | Quits the console |
$ git clone git@github.com:mfcrespo/AirBnB_clone.git
$ ./console.py
$ ./console.py
(hbnb) all <-- input 1
(hbnb)
(hbnb) User.all() <-- input 2
$ echo "all User" | ./console.py
Authors | GitHub | ||
---|---|---|---|
Maria Fernanda Crespo | mfcrespo | @mafe_crespo | mariafernandacrespo |
Crispthofer Rincon | CrispthoAlex | CrispthoAlex | carmurrain |