Coder Social home page Coder Social logo

airbnb_clone's Introduction

AirBnB clone Project

airBnB

Welcome to the AirBnB clone project!

First step: a command interpreter to manage our AirBnB objects.

This is the first step towards building our first full web application: the AirBnB clone.

  • First we created a BaseModel class that defines all common attributes/methods for other classes, and takes care of the initialization, serialization and deserialization of your future instances.

  • We created a simple flow of serialization/deserialization: Instance <-> Dictionary <-> JSON string <-> file.

  • Then we created all classes used for AirBnB (User, State, City, Place, โ€ฆ) that inherit from BaseModel.

  • We used json files as our storage engine because until now we don't have a GUI, we used the console / command interpreter (cmd module) to manipulate our storage engine.

How to start it

  • First clone the repository to your local machine.

    git clone https://github.com/mahmoudsalah296/AirBnB_clone.git
  • Run the console.py file (note: you have to be in the same directory as the console.py file and have python3 installed)

    python3 console.py
  • Now you can use the console to create, update, destroy, show, and all other CRUD operations on our objects.

  • Every time you create an object, it will be saved in a json file in the models directory called file.json

  • Available commands:

    • create: creates an object of the class name.

      $ create <class name>
    • show: shows the object of the class name with the id.

      # There are 2 ways to do that
      
      $ show <class name> <class id>
      $ <class name>.show(<class id>)
    • destroy: destroys the object of the class name with the id.

      # There are 2 ways to do that
      
      $ destroy <class name> <clas id>
      $ <class name>.destroy(<class id>)
    • all - shows all objects of the class name.

      # There are many ways to do that
      
      $ all  # If you want show all instances.
      $ all <class name>
      $ <class name>.all()
    • update: Updates an instance based on the class name and id by adding or updating attribute.

      # There are many ways to do that
      
      $ update <class name> <class id> <attribute name> "<attribute value>"
      $ <class name>.update(<id>, <attribute name>, <attribute value>)
      $ <class name>.update(<id>, <dictionary representation>)
    • count - retrieve the number of instances of a class.

       <class name>.count()
    • quit or EOF - exits the console

    • ls - lists all classes names

    • help or ? - shows the help message

airbnb_clone's People

Contributors

mdawoud27 avatar mahmoudsalah296 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.