Build API for these stories
- As an admin I want to create a room [POST /rooms]
- As a user I want to see a list of all available rooms [GET /rooms{?from,to}]
- As a user I want to book a room [POST /rooms/{id}/books]
Simple scenario
- Create a room
- View available rooms
- Book a room
- The booked room shouldn't be displayed on the available list (SIMPLE!)
npm i
npm run test:integration
npm run start:docs
# then, open http://localhost:3001
{
"id": 1,
"name": "Room 1",
"description": "Room 1 description",
"capacity": 2,
"price": 100,
"available": true
}
{
"from": "2023-10-16",
"to": "2023-10-18",
"booker": {
"name": "John Doe",
"email": "[email protected]",
"phone": "123456789"
},
"guest": {
"adults": 2,
"children": 0
}
}
{
"data": ...
}
{
"message": ...
}