Loading...
Metrics:
Looking at the metrics, there wont be much pressure on the system - can definitely handle the load even during peak hours
API DESIGN:
Public endpoints:
GET:
See available time for room
/room/:roomID&:Date
POST:
Reserve room
/room/reserve
{userID, roomID}
POST:
Cancel reservation
/room/reserve
{userID, roomID}
Core Entities:
Users
Rooms
Reservations
Use a SQL database specifically in this case because of the strong relationships between core entities - using SQL also ensures ACID properties to keep system consistent
Avoiding Double bookings:
When reserving for roomA for example, pessimistically lock roomA with a FOR UPDATE query and in the same transaction, try to make reservation