Airbnb is a web platform to rent house, rooms and more. This is the first step
to clone it. In this step we did a console to manage the objects created by the
classes to do easier the way to add, del, destroy and update objects. Also we
use a file JSON to store and persist objects. and obviusly we created our data
model.
- BaseModel
- User
- State
- City
- Amenity
- Place
- Review
- create - create an object
- show - show an object (based on id)
- destroy - destroy an object
- all - show all objects, of one type or all types
- quit/EOF - quit the console
- help - see descriptions of commands
To start, navigate to the project folder and enter ./console.py
in the shell.
create <class name>
Ex:
create BaseModel
show <class name> <object id>
Ex:
show User my_id
destroy <class name> <object id>
Ex:
destroy Place my_place_id
all
or all <class name>
Ex:
all
or all State
quit
or EOF
help
or help <command>
Ex:
help
or help quit
Additionally, the console supports <class name>.<command>(<parameters>)
syntax.
Ex:
City.show(my_city_id)