Giter Club home page Giter Club logo

atlas-airbnb_clone's Introduction

AirBnB Clone - The Console


Project Description


  • This is a Python project that implements a backend console for an upcoming AirBnB clone.
  • It is a command line interpreter that can create, read, update, and delete instances.

Table of Contents



Features


  • Can create new instances of classes
  • Display instances
  • Delete instances
  • List instances of a specified class
  • Update instances with new attributes
  • Stores instances in a JSON file
  • Supports serialization and deserialization

Commands


Command Description
create Creates a new instance of a specified class
show Displays the string representation of an instance based on class name and ID
destroy Deletes an instance based on class name and ID
all Lists string representations of all instances or instances of a specific class
update Updates an instance by adding or modifying attributes based on class name, ID, attribute name, and new attribute value

Available Models


Model Default Attributes
BaseModel id created_at updated_at
Amenity name
City state_id name
Place city_id user_id name description number_rooms number_bathrooms max_guest price_by_night latitude longitude amenity_ids
Review place_id user_id text
User email password first_name last_name

Usage


The console can be started in interactive mode with:
$ ./console.py
You can also pass arguments to the console in non-interactive mode with:
$ echo "create User" | ./console.py

Examples:

list all classes in the console

(hbnb)all
[]

create User instance

(hbnb)create User
992f2a78-7f3c-4bba-8446-22ff71931981

display specific User instance with ID

(hbnb)show User 992f2a78-7f3c-4bba-8446-22ff71931981
[User] (992f2a78-7f3c-4bba-8446-22ff71931981) {'id': '992f2a78-7f3c-4bba-8446-22ff71931981', 'created_at': datetime.datetime(2024, 2, 5, 17, 46, 54, 609066), 'updated_at': datetime.datetime(2024, 2, 5, 17, 46, 54, 609080)}

update User instance attribut 'email' to be '[email protected]'

(hbnb)update User 992f2a78-7f3c-4bba-8446-22ff71931981 email [email protected]
(hbnb)show User 992f2a78-7f3c-4bba-8446-22ff71931981
[User] (992f2a78-7f3c-4bba-8446-22ff71931981) {'id': '992f2a78-7f3c-4bba-8446-22ff71931981', 'created_at': datetime.datetime(2024, 2, 5, 17, 46, 54, 609066), 'updated_at': datetime.datetime(2024, 2, 5, 17, 46, 54, 609080), 'email': '[email protected]'}

dislay all intances and their respective attribites

(hbnb)all
["[User] (992f2a78-7f3c-4bba-8446-22ff71931981) {'id': '992f2a78-7f3c-4bba-8446-22ff71931981', 'created_at': datetime.datetime(2024, 2, 5, 17, 46, 54, 609066), 'updated_at': datetime.datetime(2024, 2, 5, 17, 46, 54, 609080), 'email': '[email protected]'}"]

delete specified User instance with ID

(hbnb)destroy User 992f2a78-7f3c-4bba-8446-22ff71931981
(hbnb)all
[]

quit console

(hbnb)quit


Testing


All tests are in unittest format and are inside the /tests directory. Run the tests with:

python3 -m unittest discover tests


Authors


Collin Ballard - https://github.com/Collinb19
Evan Markle - https://github.com/EJMarkle


atlas-airbnb_clone's People

Contributors

collinb190 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.