๐ Reservations API โ
๐ Check Availability โ
GET /api/reservations/availability?locationId=...&date=2025-06-15&time=19:00&partySize=4Public. Checks if tables are available.
Response:
json
{
"success": true,
"data": {
"available": true,
"tables": [
{ "id": "table-id", "name": "Table 3", "capacity": 4 }
]
}
}โ Create Reservation โ
POST /api/reservations
Authorization: Bearer <customer-token>Request:
json
{
"locationId": "location-id",
"date": "2025-06-15",
"time": "19:00",
"partySize": 4,
"comment": "Birthday dinner, window seat preferred"
}Response: 201 Created
json
{
"success": true,
"data": {
"id": "cuid",
"date": "2025-06-15",
"time": "19:00",
"partySize": 4,
"status": "PENDING",
"comment": "Birthday dinner, window seat preferred"
}
}๐๏ธ List Customer Reservations โ
GET /api/reservations/my-reservations
Authorization: Bearer <customer-token>Returns reservations for the authenticated customer.
๐ List All Reservations (Staff) โ
GET /api/reservations
Authorization: Bearer <staff-token>Returns all reservations with pagination. Staff only.
๐ Get Reservation โ
GET /api/reservations/:id
Authorization: Bearer <token>โ๏ธ Update Reservation โ
PATCH /api/reservations/:id
Authorization: Bearer <staff-token>Request:
json
{
"status": "CONFIRMED",
"tableId": "table-id"
}๐๏ธ Delete Reservation โ
DELETE /api/reservations/:id
Authorization: Bearer <staff-token>๐ Permissions Summary โ
| Action | Required Role |
|---|---|
| ๐ Check availability | Public |
| โ Create reservation | Authenticated customer |
| ๐ค View own reservations | Authenticated customer |
| ๐ List all reservations | Staff |
| โ๏ธ Update reservation | Staff |
| ๐๏ธ Delete reservation | Staff |
โ ๏ธ Error Cases โ
| Scenario | Status | Error |
|---|---|---|
| ๐ช No tables available | 400 | No availability for the requested time |
| ๐ฅ Party size too large | 400 | No table with sufficient capacity |
| ๐ Location not found | 404 | Location not found |
| ๐ Past date | 400 | Cannot reserve in the past |