GithubHelp home page GithubHelp logo

victor-ok / airbnb_clone_v4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tayebwa-ian/airbnb_clone_v3

0.0 0.0 0.0 149 KB

ALX AirBnB clone Version 4 - Web Dynamic

Shell 0.33% Python 51.63% CSS 11.08% HTML 33.03% JavaScript 3.93%

airbnb_clone_v4's Introduction

0x02. AirBnB clone - MySQL


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…

Each task is linked and will help you to:

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

What’s a command interpreter?


A shell like interface but limited to a specific use-case. In our case, we want to be able to manage the objects of our project:

Create a new object (ex: a new User or a new Place)
Retrieve an object from a file, a database etc…
Do operations on objects (count, compute stats, etc…)
Update attributes of an object
Destroy an object

Installation


  1. Clone This Repo git clone from
  2. Access AirBnb directory: cd AirBnB_clone
  3. Install pycodestyle: pip install pycodestyle
  4. Run hbnb(interactively): ./console and enter command
  5. Run hbnb(non-interactively): echo "" | ./console.py

Available Command:


  • quit and EOF to exit the program
  • help for every Command
  • create
  • show
  • destroy
  • all
  • update
  • count

Command interpreter Usage:


(hbnb) all Vser 
** class doesn't exist ** 
(hbnb) all 
["[User] (337c109d-e787-4b7b-a3f0-88f66ba9953f) {'id': '337c109d-e787-4b7b-a3f0-88f66ba9953f', 'created_at': datetime.datetime(2024, 1, 12, 21, 32, 18, 490270), 'updated_at': datetime.datetime(2024, 1, 12, 21, 32, 18, 490372)}", "[User] (70338bed-f448-4af4-968b-0cbfd091f03a) {'id': '70338bed-f448-4af4-968b-0cbfd091f03a', 'created_at': datetime.datetime(2024, 1, 12, 23, 1, 6, 575487), 'updated_at': datetime.datetime(2024, 1, 12, 23, 1, 6, 575510)}", "[Place] (7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c) {'id': '7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c', 'created_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886310), 'updated_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886327)}", "[User] (51841181-58dd-4f8c-93ef-b8e0102cb1cc) {'id': '51841181-58dd-4f8c-93ef-b8e0102cb1cc', 'created_at': datetime.datetime(2024, 1, 12, 23, 26, 1, 995499), 'updated_at': datetime.datetime(2024, 1, 12, 23, 26, 1, 995519)}"] 
(hbnb) show Place 7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c 
[Place] (7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c) {'id': '7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c', 'created_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886310), 'updated_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886327)} 
(hbnb) all Place 
["[Place] (7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c) {'id': '7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c', 'created_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886310), 'updated_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886327)}"] 
(hbnb) show Place 
** instance id missing ** 
(hbnb) show 
** class name missing ** 
(hbnb) create City 
a78c8527-cfad-4eda-a02d-d43b63a338e0 
(hbnb) update City a78c8527-cfad-4eda-a02d-d43b63a338e0 name Arua 
(hbnb) update City a78c8527-cfad-4eda-a02d-d43b63a338e0 name 
** value missing ** 
(hbnb) update City a78c8527-cfad-4eda-a02d-d43b63a338e0 
** attribute name missing ** 
(hbnb) update City 
** instance id missing ** 
(hbnb) destroy City a78c8527-cfad-4eda-a02d-d43b63a338e0  
(hbnb) User.all()
["[User] (337c109d-e787-4b7b-a3f0-88f66ba9953f) {'id': '337c109d-e787-4b7b-a3f0-88f66ba9953f', 'created_at': datetime.datetime(2024, 1, 12, 21, 32, 18, 490270), 'updated_at': datetime.datetime(2024, 1, 12, 21, 32, 18, 490372)}"]
(hbnb) Place.all()
["[Place] (7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c) {'id': '7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c', 'created_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886310), 'updated_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886327)}"]
(hbnb) Place.show(7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c)
[Place] (7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c) {'id': '7643d25f-18c3-4f47-b9ec-d3f3b64f2f6c', 'created_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886310), 'updated_at': datetime.datetime(2024, 1, 12, 23, 3, 55, 886327)}
(hbnb) User.update("337c109d-e787-4b7b-a3f0-88f66ba9953f", {'first_name': "Samuel", "age": 29})
(hbnb) User.count()
1
(hbnb) create User
c72caf8e-5018-4e04-a253-72694d8b8850
(hbnb) User.count()
2
(hbnb) User.update("c72caf8e-5018-4e04-a253-72694d8b8850", "first_name", "Muhumuza")
(hbnb) count User
2
(hbnb) quit

airbnb_clone_v4's People

Contributors

tayebwa-ian avatar big-foot1 avatar victor-ok 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.