Professional Documents
Culture Documents
Documentation: 1) How To Run
Documentation: 1) How To Run
1) How to run:
You just a text editor to run this code (VS code) is preferable. Open the terminal and
simply run the command python main.py in order to start execution of the program.
Furthermore, you need to have following things installed which can be done using following
commands:
Pip install firebase
Pip install python_jwt
Pip install gcloud
pip install cryptodom or
pip pycryptodome==3.4.3
2) Template Folder:
The template folder consist of HTML files which make up the view
3) Python Files
The project consist of following python files
Room.py
Users.py
DataHandler.py
main.py
4) Room.py
Room file has a class named room and has two functions
1) def __init__(self):
This is the constructor of class room it declares the attributes, which
room class object will have. The attributes are
6) DataHanlder.py
This is the class which act as the controller all the data manipulation
occurs in this file. In this class the previous are imported. The csv class is also imported.
DataHandler class has following functions in it:
1) def __init__(self):
This is the constructor of class datahandler it declares the attributes,
which user class object will have. The attribute along with their data structures are as
follow
users : List() (this is a List which stores all the
user)
rooms : List() (this is a List which stores all the
available rooms)
2) def readAllUsers():
This function reads all the available users from the database and then
iterate over the list and the attributes are stored into the object of USER is read and stored
into the list of user.
3) def readAllRooms():
This function reads all the available rooms from the database file and
then iterate over the list and the attributes are stored into the of the object of ROOM is
read and stored into the list of user.
7) Main.py
This file act as a view. All the views are rendered from this file and data is
manipulated between controller and then model classes. The class has following
functions in it. These functions responds to different on screen events which takes place
at model.
1) def main():
When the app start execution main run and this function starts its
execution at first. This function renders the log in page. User enter his email
and password and validateUser() is called if the credential are valid user is
logged into the account and userAccount.html page is rendered this is the main
menu page and control is handled to the userAccount() function. In case
credentials are not validated invalid credentials message is displayed and user
are asked to reenter the credentials.
2) def userAccount():
This function renders all the rooms in the database to
user on logging in. Along with this all the buttons which provides different are render.
Display all room, search specific room, book a room, delete a room, add a new room, delete a
room, delete booking, log out all these are displayed here in the view.
If user clicks on the button Display all rooms readAllRooms() function is called from
DataHandler which returns all the available rooms.
If user clicks the button add new room, a new pages is rendered and control is
handled to the addRoom() function which ask user to enter room number, beds, ac,
window, rate of room and calls bookRoom() function.
If user clicks the button add delete room, a new pages is rendered and control is
handled to the deleteRoom() function. The new page ask user to enter the room
number. After this function from DataHandler is called which delete The Room if it
has not been booked already.
If user clicks the button bookRoom() new page is rendered which asks the user to
enter the room which he wants to book and bookRoom() function is called from the
DataHandler class.
When use clicks the button log out it is retured to the log in pages where he has to log
in again.