Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FloresJesus/SS_RESTAURANT/llms.txt

Use this file to discover all available pages before exploring further.

The Tables API manages the physical tables in the restaurant. Each table tracks its current occupancy state and seating capacity. Table states are updated automatically by the Orders API when orders are created or completed — staff can also update them manually through the PATCH endpoint. All endpoints require a valid JWT in the Authorization: Bearer <token> header.

Endpoint overview

MethodPathDescription
GET/api/tablesList all tables with active-order flag
GET/api/tables/disponiblesList tables currently in libre state
GET/api/tables/:idGet a single table by ID
POST/api/tablesCreate a new table
PUT/api/tables/:idFull update (number, capacity, and state)
PATCH/api/tables/:id/estadoUpdate table state only
DELETE/api/tables/:idDelete a table

Table object

id
number
Unique table identifier.
numero
number
Human-readable table number displayed on the floor plan (e.g. 5).
capacidad
number
Maximum number of seated guests.
estado
string
Current occupancy state. One of:
  • libre — table is empty and available.
  • ocupada — table has an active order in progress.
  • mantenimiento — table is out of service.
The tiene_pedido_activo boolean flag is only present on responses from GET /api/tables. It is not returned by GET /api/tables/:id or GET /api/tables/disponibles. See the GET /api/tables section for details.

GET /api/tables

Returns all tables ordered by table number ascending. Each table object includes the computed tiene_pedido_activo flag indicating whether the table has an open order today.
tiene_pedido_activo
boolean
true when at least one order for this table has estado_servicio of pendiente, preparando, or listo and was created today. Computed at query time — not stored in the database. Only present on the list response.

Example table object (list response)

{
  "id": 3,
  "numero": 3,
  "capacidad": 4,
  "estado": "ocupada",
  "tiene_pedido_activo": true
}
curl https://your-api-host/api/tables \
  -H "Authorization: Bearer <token>"

GET /api/tables/disponibles

Returns only tables whose estado is currently libre. Useful for quickly building a table-picker UI for new orders or walk-in reservations. Response objects contain id, numero, capacidad, and estado — the tiene_pedido_activo flag is not included.
curl https://your-api-host/api/tables/disponibles \
  -H "Authorization: Bearer <token>"
This endpoint does not cross-check existing reservations. To find tables free during a specific time window, use the reservations availability endpoint: GET /api/reservations/mesas-disponibles.

GET /api/tables/:id

Returns a single table by ID. The response contains id, numero, capacidad, and estado. The tiene_pedido_activo flag is not included in single-record responses. Returns 404 if the table does not exist.
curl https://your-api-host/api/tables/3 \
  -H "Authorization: Bearer <token>"
{
  "id": 3,
  "numero": 3,
  "capacidad": 4,
  "estado": "ocupada"
}

POST /api/tables

Creates a new table. The new table is created in libre state by default.

Request body

numero
number
required
Table number. Must be unique — attempting to create a duplicate returns 400 El numero de mesa ya existe.
capacidad
number
required
Seating capacity. Must be a positive integer.

Example request

curl -X POST https://your-api-host/api/tables \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "numero": 12,
    "capacidad": 6
  }'

Example response

{
  "message": "Mesa creada correctamente",
  "id": 12
}

PUT /api/tables/:id

Performs a full replacement update on a table record. All three body fields are required.

Request body

numero
number
required
New table number.
capacidad
number
required
New seating capacity.
estado
string
required
New state. Must be one of libre, ocupada, or mantenimiento.
curl -X PUT https://your-api-host/api/tables/12 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "numero": 12,
    "capacidad": 8,
    "estado": "mantenimiento"
  }'

PATCH /api/tables/:id/estado

Updates only the estado field of a table. Ideal for quick status changes from the floor-plan view without sending the full table payload.

Request body

estado
string
required
Must be one of libre, ocupada, or mantenimiento. Any other value returns 400 Estado invalido.

Example request

curl -X PATCH https://your-api-host/api/tables/12/estado \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "estado": "libre" }'

Example response

{
  "message": "Estado de mesa actualizado correctamente"
}

DELETE /api/tables/:id

Permanently deletes a table record. Returns 404 if the table does not exist.
curl -X DELETE https://your-api-host/api/tables/12 \
  -H "Authorization: Bearer <token>"

Automatic state transitions

You do not need to call PATCH /api/tables/:id/estado during normal order flow. The Orders API manages table states automatically:
  • Creating an order (POST /api/orders) sets the linked table’s estado to ocupada.
  • Updating order status to delivered or cancelled sets the table’s estado back to libre.
Use PATCH /api/tables/:id/estado only when you need to override state manually — for example, placing a table under mantenimiento for cleaning, or recovering from an interrupted workflow.

Build docs developers (and LLMs) love