LightBnB is an app that revolutionizes the travel industry. It allows home owners to rent out their homes to people on vacation, creating an alternative to hotels and B&Bs.
It's time to start working on the LightBnB app. Before we start doing anything technical, we're going to design the database. This is a multi billion dollar idea, so we want to get the database right, the first time.
Create an Entity Relationship Design for our LightBnB app with the following specifications:
-
The app will have
users
,properties
,reservations
, andproperty reviews
. -
A
user
will have aname
,email address
, andpassword
. -
A
property
will have atitle
,description
,cost_per_night
,parking\_spaces
,number_of_bathrooms
, andnumber_of_bedrooms
. -
A
property
will need to have images associated with it, so for now we will store a url for a smallthumbnail photo
and a largecover photo
. -
A
property
will need address data associated with it includingcountry
,street
,city
,province
,post_code
-
A
property
can either beactive
or notactive
depending on weather the owner is currently renting it out or not. -
A
property
will have an owner which will be one of the registered users. -
A
reservation
will have astart date
and anend date
-
A
reservation
will be made by a guest, which will be a registered user, and will be associated with a singleproperty
-
A
property review
will have amessage
and arating
from 1 to 5 -
A
property review
can be made by a guest and will be associated with a singlereservation
-
A
user
can own manyproperties
-
A
property
belongs to oneowner
-
A
user
can make manyreservation
-
A
reservation
belongs to oneguest
-
A
property
can be reviewed by manyguests
public
contains all of the HTML, CSS, and client side JavaScript.sass
contains all of the sass files.server
contains all of the server side code.server.js
is the entry point to the application. This connects the routes to the database.apiRoutes.js
anduserRoutes.js
are responsible for any HTTP requests to/users/something
or/api/something
.json
is a directory that contains a bunch of dummy data in.json
files.database.js
is responsible for all queries to the database. It doesn't currently connect to any database, all it does is return data from.json
files.