Generic Hotel API for a basic hotel booking system created with NestJS and SQLite.
(this is a hobby project to learn NestJS)
- Develop
/hotels
route- split
address
into address Object instead of string - implement
/:id/rooms
after basic/rooms
route is created - add "number of rooms" to
GET /hotels/:id
Issue - implement
/:id/categories
after basic/categories
route is created
- split
- Develop
/rooms
route - Develop
/categories
route - Develop
/reservations
route- add
/:id/rooms
route
- add
- Develop
/guests
route- add
/:id/reservations
- add
- Set up typeorm relations (
POST
)- hotel --> rooms (OneToMany)
- rooms --> hotels (ManyToOne)
- categories --> rooms (OneToMany)
- rooms --> categories (ManyToOne)
- hotel --> cateogies (OneToMany)
- categories --> hotels (ManyToOne)
- reservations --> categories (ManyToMany)
- categories --> reservations (ManyToMany)
- reservations --> rooms (ManyToMany)
- rooms --> reservations (ManyToMany)
- reservations --> guest (ManyToOne)
- guest --> reservations (OneToMany)
- Set up typeorm relations for
PATCH
methods-
/hotels
-
/rooms
-
/categories
-
/reservations
-
/guests
-
- add Swagger for API documentation
- add validation that
POST /rooms
can only containroomCategory
that belongs tohotel
in request - add validation that roomNumbers cannot be used multiple times in same hotel
- Strategy for date availability checker
- Integrate authentication
- Connect with Webflow API (as database option)
This project serves a simple hotel booking system API that includes the following aspects (CRUD):
- hotels can be created, viewed, updated, and deleted
- room categories can be created, viewed, updated, and deleted
- rooms can be created, viewed, updated, and deleted
- guests can be created, viewed, updated, and deleted
- reservations can be created, viewed, updated, and deleted
A hotel has basic information, such as:
- id
- hotel name
- star rating
- address
- number of rooms (dynamic, based on rooms attached to hotel)
- room categories (dynamic, based on room categories attached to hotel)
Room categories are always tied to a hotel. One room category can not have multiple hotels, but a hotel can have multiple room categories. The name of the room category is shown in the frontend of the booking system (and therefore what a guest books)
A room category has basic information, such as:
- id
- hotel
- name
- number of rooms (dynamic, based on rooms attached to room category)
- balcony [true/false]
- baththub [true/false]
- shower [true/false]
- view [park, inland, sea view, partial sea view, sea front]
- number of adults per room
- number of children per room
- price per night
A room is tied to a room category and a hotel. Rooms are identified by their room number. The room name (e.g. displayed in a booking frontend) derives from the room category, therefore an individual room has no name.
A room has basic information, such as:
- id (primary key in database)
- room number (individual to the hotel's numbering system)
- hotel
- room category
- size
- smoking allowed [true/false]
- pets allowed [true/false]
Guests can have multiple reservations and have basic information, such as:
- id
- name
- gender
- preferred payment method
- billing address
- staff notes
Reservations are connected to guests, room categories, and rooms. When a guest makes a reservation, only a room categroy is assigned. Hotel staff can later on assign an individual room. One reservation can have multiple room (categories).
Reservations have basic information, such as:
- id
- guest
- hotel
- room categories
- rooms
- arrival date
- departure date
- total price
- number of adults
- number of children
- pets
- notes