Skip to content

git-birdy/hotelsite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hotelsite

Hotelsite is a hotel booking website and api built for the CSUMB CST438 final project.

Installation

This Hotelsite is deployed on heroku.

If cloning the code to deploy elsewhere,

  • Update the application.properties file with the database connection info
  • Run the hotelsite_v2.sql file (located in the root directory) in MySQL to build the schema and tables in your database and fill the hotels table with data

Usage

Visit the /hotelsearch page to book a reservation through the web app.

To use the hotel api directly, use the following HTTP commands.

Search for a hotel

GET /api/hotels/{city}

If hotels are found, it returns a json file containing a list of json objects one for each hotel.

If no hotels are found for that city, returns 404 NOT FOUND.

Example

GET /api/hotels/new%20york

Returns:

[
    {
        "id": 2,
        "name": "Marriot",
        "address": "321 Main St.",
        "city": "New York",
        "stars": 5,
        "price": 150
    },
    {
        "id": 1,
        "name": "Holiday Inn",
        "address": "123 Main St",
        "city": "New York",
        "stars": 5,
        "price": 100
    }
]

Create Reservation

POST /api/reservation

with the body of the HTTP POST containing for example

{
    "hotelId": 2,
    "roomtype": "double",
    "startdate": "2021-06-18",
    "enddate": "2021-06-19"
}

This results in the following saved entity

{
    "id": 36,
    "hotelId": 2,
    "roomtype": "double",
    "startdate": "2021-06-18",
    "enddate": "2021-06-19",
    "user": null
}

Note: user is null, so package-booked hotel reservations can't be searched for by user.

The API user must save the returned "id" generated for the reservation to access this reservation later if it needs to be updated or deleted.

Retrieve hotel info

GET /api/hotel/{hotelid}

Returns a json object of the hotel or 404 NOT FOUND.

Update reservation

PUT /api/reservations/{reservationid}

with the body of the HTTP PUT containing for example

{
    "id": 34,
    "hotelId": 2,
    "roomtype": "queen",
    "startdate": "2021-06-18",
    "enddate": "2021-06-18",
}

Note: The user cannot be reassigned and will be ignored if included in the json object passed.

Delete reservation

DELETE /api/reservations/{reservationid}

If successful, returns 204 request successful, no content returned. If fails, returns 404 Not Found.

Acknowledgements

Thanks go to Bijan Pourazari from Team 8 (working on the Travel site 2) for collaborating with us on the api design.

Thanks go to Professor Wisneski for staying late in office hours Monday and Tuesday nights to help debug and help direct our efforts on the project.

Project Status

The original contributors have stopped development of this site. Future developers may wish to continue adding some of the planned features,

  • Add filter feature to hotel search
  • Add web app interface for updating an existing reservation
  • Add account page to view past reservations and book hotel again
  • Add review option for users to review past bookings
  • Add reviews link next to stars displayed in hotel search results to view past reviews

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published