TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/123048152-JJDS/CafeteriaPM_S203/llms.txt
Use this file to discover all available pages before exploring further.
/mesas/ endpoints manage the physical dining tables in the cafeteria. Rather than storing status as a column, table state is computed on every request by checking whether an active order exists for the table. This means the values disponible, ocupada, and reservada always reflect the real-time state of the system, and there is no risk of stale flags. All state changes — occupying, releasing, reserving, or cancelling a reservation — work by creating or transitioning the underlying order, not by updating a status field on the table itself.
Endpoints
List all tables
Bearer <token> — Any authenticated user.Internal table ID.
Display table number shown to staff.
Maximum seating capacity.
Live status:
disponible, ocupada, or reservada.ID of the active order, or
null if the table is available.Get a single table
Bearer <token> — Any authenticated user.Internal ID of the table to retrieve.
MesaOut shape as the list endpoint. Returns 404 if no table with that ID exists.
Example response
| Status | Detail |
|---|---|
404 | "Mesa no encontrada" |
Get a table by display number
Bearer <token> — Any authenticated user.numero field — the human-readable display number that staff reference on the floor. This is distinct from the internal id.
The display number assigned to the table (e.g.
5 for “Table 5”).| Status | Detail |
|---|---|
404 | "Mesa número {numero} no encontrada" |
Create a table
Bearer <token> — Role: admin.numero must be unique across all tables. The new table is returned with estado: "disponible" and pedido_activo_id: null.
Request body
Display table number. Must be unique. Cannot be changed after creation.
Maximum seating capacity for the table (number of guests).
201 Created
| Status | Detail |
|---|---|
400 | "Ya existe una mesa con el número {numero}" |
Delete a table
Bearer <token> — Role: admin.Internal ID of the table to delete.
ocupada or reservada — the active order must be closed first. It is also rejected if the table has historical (completed) orders linked to it, preserving referential integrity.
Response — 204 No Content
Error responses
| Status | Detail |
|---|---|
404 | "Mesa no encontrada" |
400 | "No se puede eliminar la mesa porque está {estado}. Primero debe cerrar el pedido #{pedido_id}." |
400 | "No se puede eliminar la mesa porque tiene pedidos históricos asociados." (raised on IntegrityError) |
Occupy a table
Bearer <token> — Roles: admin, mesero.Internal ID of the table to mark as occupied.
Order record in pendiente state, linked to the table and the calling user as the assigned waiter. The response includes the new order’s ID so the caller can immediately begin adding items to it.
Response
| Status | Detail |
|---|---|
404 | "Mesa no encontrada" |
400 | "La mesa ya está ocupada" |
500 | "Estado 'pendiente' no configurado" (system misconfiguration) |
Release a table
Bearer <token> — Roles: admin, mesero, caja.Internal ID of the table to release.
pagado status, bypassing the normal payment flow through /ventas/. An OrderStatusHistory record is written to audit the transition. Use this endpoint for quick cleanup operations rather than as a substitute for proper payment registration. Note that this endpoint only acts on orders in pendiente, en_preparacion, listo, or entregado states — a table in reservada state cannot be released with this endpoint; use PATCH /mesas/{mesa_id}/cancelar-reserva instead.
Response
| Status | Detail |
|---|---|
404 | "Mesa no encontrada" |
400 | "La mesa no tiene pedido activo" |
500 | "Estado 'pagado' no configurado" (system misconfiguration) |
Reserve a table
Bearer <token> — Roles: admin, mesero.Internal ID of the table to reserve.
Order in reservado state. Only tables with estado: "disponible" can be reserved — occupied tables and tables with an existing reservation both return 400.
Response
| Status | Detail |
|---|---|
404 | "Mesa no encontrada" |
400 | "La mesa no está disponible para reservar" |
500 | "Estado 'reservado' no configurado" (system misconfiguration) |
Cancel a reservation
Bearer <token> — Roles: admin, mesero.Internal ID of the table whose reservation should be cancelled.
reservado order is transitioned to cancelado status (or deleted if the cancelado status is not configured). After cancellation the table’s computed status returns to disponible.
Response
| Status | Detail |
|---|---|
404 | "Mesa no encontrada" |
400 | "La mesa no tiene una reserva activa" |
The MesaOut object
Every read endpoint returns a MesaOut object. The estado and pedido_activo_id fields are computed dynamically on each request and are never persisted as columns.
Internal table ID.
Display table number shown to staff.
Maximum seating capacity.
Live status:
disponible, ocupada, or reservada.ID of the active order, or
null if the table is available.Table status state machine
Theestado value is derived from the order linked to the table, not from any stored field. The full lifecycle looks like this:
pendiente, en_preparacion, listo, or entregado yields "ocupada". An order in reservado state yields "reservada". No active order in any of those states means "disponible".