Skip to content

๐Ÿ“… Reservations API โ€‹

๐Ÿ” Check Availability โ€‹

GET /api/reservations/availability?locationId=...&date=2025-06-15&time=19:00&partySize=4

Public. 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 โ€‹

ActionRequired Role
๐ŸŒ Check availabilityPublic
โž• Create reservationAuthenticated customer
๐Ÿ‘ค View own reservationsAuthenticated customer
๐Ÿ“‹ List all reservationsStaff
โœ๏ธ Update reservationStaff
๐Ÿ—‘๏ธ Delete reservationStaff

โš ๏ธ Error Cases โ€‹

ScenarioStatusError
๐Ÿช‘ No tables available400No availability for the requested time
๐Ÿ‘ฅ Party size too large400No table with sufficient capacity
๐Ÿ“ Location not found404Location not found
๐Ÿ“… Past date400Cannot reserve in the past