Skip to content

lawrence1986/AirBnB_clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

168 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AirBNB - The Console

Holberton AirBnB Clone project


This is the first portion of a project to build a clone of the AirBnB website. The first goal of this project is to create a program that serializes and deserializes objects into json files, and reloads them on startup for use between sessions, or in other words making the data persist between sessions.

The second goal of the project is to build a console to manage all this stored data. The console is made to update, delete, and create new instances of any class of data. It also keeps track of when the objects it has made were created, and updated.

  • This is a TEAM Project done during Full Stack Software Engineering studies at ALX School. It aims to learn about building your first full web application: the AirBnB clone**.

Requirements

  • Allowed editors: vi, vim, emacs
  • All files would be interpreted/compiled on ubuntu 20.04 LTS using python3 (version 3.8.5)
  • All files must end in a New Line
  • Team Member: Lawrence Maduabuchi & Abdullahi Ngui.
  • Date: August 7th 2023
  • The first line of all your files should be exactly #!/usr/bin/python3
  • Your code should use the pycodestyle (version 2.8.*)
  • All your files must be executable
  • The length of your files will be tested using wc
  • All your modules should have a documentation (python3 -c 'print(import("my_module").doc)')
  • All your classes should have a documentation (python3 -c 'print(import("my_module").MyClass.doc)')

Python UnitTests

  • All your test files should be inside a folder tests
  • You have to use the unittest module
  • All your test files should be python files (extension: .py)
  • All your test files and folders should start by test_
  • Your file organization in the tests folder should be the same as your project
  • All your tests should be executed by using this command: python3 -m unittest discover tests

General Use


  1. First clone this repository.
  2. Once the repository is cloned locate the "console.py" file and run it as follows
/AirBnB_clone$ ./console.py
  1. When this command is run the following prompt should appear:
(hbnb)
  1. This prompt designates you are in the "HBnB" console, there are a variety of commands available once the console program is run.
Commands
* create - Creates an instance based on given class

* destroy - Destroys an object based on class and UUID

* show - Shows an object based on class and UUID
* all - Shows all objects the program has access to, or all objects of a given class

* update - Updates existing attributes an object based on class name and UUID

* quit - Exits the program (EOF will as well)

- It is possible to call <class_name>.<command>(arguments) as well

Examples


Example 0: Create an object

Usage: create <class_name>

(hbnb) create BaseModel
(hbnb) create BaseModel
3aa5babc-efb6-4041-bfe9-3cc9727588f8
(hbnb)
Example 1: Show an object

Usage: show <class_name> <class_id>

(hbnb) show BaseModel 3aa5babc-efb6-4041-bfe9-3cc9727588f8
(hbnb) show BaseModel 3aa5babc-efb6-4041-bfe9-3cc9727588f8
[BaseModel] (3aa5babc-efb6-4041-bfe9-3cc9727588f8) {'id': '3aa5babc-efb6-4041-bfe9-3cc9727588f8', 'created_at': datetime.datetime(2023, 08, 12, 14, 21, 12, 96959), 
'updated_at': datetime.datetime(2023, 08, 12, 14, 21, 12, 96971)}
(hbnb)  

Files

All of the following files are programs written in Python:

Filename Description
0. README, AUTHORS AUTHORS
1. Be pycodestyle compliant! Prints a char.
2. Unittests tests
3. BaseModel models/base_model.py, models/init.py, tests/
4. Create BaseModel from dictionary models/base_model.py, tests/.
5. Store first object models/engine/file_storage.py, models/engine/init.py, models/init.py, models/base_model.py, tests/
6. Console 0.0.1 console.py
7. Console 0.0.1 Update your command interpreter (console.py) to have these commands:
8. First User Write a class User that inherits from BaseModel: models/user.py, models/engine/file_storage.py, console
9. More classes! Write all those classes that inherit from BaseModel:
10. Console 1.0 Update FileStorage to manage correctly serialization and deserialization of all our new classes: Place, State, City, Amenity and Review
11. All instances by class name Update your command interpreter (console.py) to retrieve all instances of a class by using: .all().
12. Count instances Update your command interpreter (console.py) to retrieve the number of instances of a class: .count().
13. Show Update your command interpreter (console.py) to retrieve an instance based on its ID: .show().
14. Destroy Update your command interpreter (console.py) to destroy an instance based on his ID: .destroy().
15. Update Update your command interpreter (console.py) to update an instance based on his ID: .update(, ).
'16. Update from dictionary' Update your command interpreter (console.py) to update an instance based on his ID with a dictionary: .update(, ).
'17. Unittests for the Console! Write all unittests for console.py, all features! For testing the console, you should “intercept” STDOUT of it, we highly recommend you to use:with patch('sys.stdout', new=StringIO()) as f:
HBNBCommand().onecmd("help show")|

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •