This is a simple Reservation API built with NestJS. It allows for
- initializing tables
- reserving tables for customers
- canceling reservations
- retrieving all reservations.
- reset tables
- Node.js (version 18 or higher)
- Docker (if you want to run the project using Docker)
$ npm install
There are 2 options for running application
$ docker compose up --build
$ npm start
After startup is done, the application will be available at http://localhost:3000/api.
- URL:
/reservations/initialize
- Method:
POST
- Query Parameters:
totalTables
(number): The total number of tables to initialize.
- Responses:
201 Created
: Tables have been initialized.400 Bad Request
: Invalid parameters or tables already initialized.
- URL:
/reservations/reserve
- Method:
POST
- Query Parameters:
customers
(number): The number of customers to reserve tables for.
- Responses:
200 OK
: Tables have been reserved.400 Bad Request
: Invalid parameters or not enough tables available.
- URL:
/reservations/cancel
- Method: POST
- Query Parameters:
bookingId
(string): The ID of the booking to cancel.
- Responses:
200 OK
: Reservation has been cancelled.404 Not Found
: Booking ID not found.
- URL:
/reservations/all-reservations
- Method: GET
- Responses:
200 OK
: Returns all reservations.404 Not Found
: No reservations found.
- URL:
/reservations/reset
- Method: POST
- Responses:
205 OK
: Returns null
$ npm run test:unit
$ npm run test:e2e