Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luisumit/LaPreviaRestobar/llms.txt

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

An order in La Previa Restobar is the primary unit of work: it links a table to a list of menu items and tracks the full journey from the moment a waiter submits it to the kitchen through to payment. Each order moves through a defined set of statuses; the status field drives UI state on both the waiter’s Android device and the kitchen display. When an order is confirmed (moves to ACEPTADO), the inventory subsystem decrements stock for every item that has trackInventory: true.

Order Status Lifecycle

PENDING → ENVIADO → ACEPTADO → EN_PREPARACION → LISTO → ENTREGADO → COMPLETED
                                                                    ↘ CANCELLED
StatusMeaning
PENDINGOrder created locally, not yet sent to the backend
ENVIADOOrder sent to the server and visible to kitchen staff
ACEPTADOKitchen has acknowledged and accepted the order
EN_PREPARACIONKitchen is actively preparing the dishes
LISTOFood is ready for pick-up or delivery to the table
ENTREGADOFood has been delivered to the table; table remains occupied
COMPLETEDOrder settled; table can be cleared
CANCELLEDOrder was cancelled before completion

OrderDto — API Response Fields

The fields below describe OrderDto, the object returned by every orders API endpoint. The Android OrderDto is intentionally lightweight — it carries exactly the fields listed here.
id
string
required
Unique order identifier (UUID or Firebase push key).
tableId
integer
required
Numeric ID of the table this order belongs to.
tableNumber
integer
required
Human-readable table number shown on receipts and kitchen tickets.
status
string
required
Current order status. One of PENDING, ENVIADO, ACEPTADO, EN_PREPARACION, LISTO, ENTREGADO, COMPLETED, CANCELLED.
total
number
required
Total order amount in local currency. Equal to the sum of all item.subtotal values.
createdAt
number
required
Unix epoch timestamp (milliseconds) when the order was created.
updatedAt
number
required
Unix epoch timestamp (milliseconds) of the last status change.
Local model fields: The fields waiterId, waiterName, notes, version, syncStatus, and items exist on the local Order model (used by Room and the Android ViewModel) but are not part of OrderDto and are therefore not returned by the API. The items array lives in the Firebase document and is populated when the Android client hydrates the record from its local Room cache. The version and syncStatus fields are managed client-side only.

Local Order model — additional fields (not in API response)

These fields are present on the Order data class used by the Android app after mapping from OrderDto:
waiterId
string | null
ID of the waiter who created the order. May be null for orders created without an authenticated session.
waiterName
string | null
Display name of the waiter, used on kitchen tickets.
notes
string | null
Free-text notes from the waiter (e.g. "sin cebolla", "alergia a mariscos").
version
number
Optimistic concurrency counter. Incremented on every write.
syncStatus
string
Local sync state on the Android client. Values: PENDING, SYNCED, ERROR. Defaults to PENDING.
items
array
List of ordered items. Each element is an OrderItem.

GET /orders

Returns every order stored in Firebase, regardless of status or table.
curl -X GET http://localhost:3000/orders \
  -H "Accept: application/json"
Response 200 OK
[
  {
    "id": "order_11a2b3",
    "tableId": 3,
    "tableNumber": 3,
    "status": "EN_PREPARACION",
    "createdAt": 1717201000000,
    "updatedAt": 1717201500000,
    "total": 4500.0
  }
]

GET /orders/table/{tableId}

Returns all orders associated with a specific table, ordered by createdAt descending in the Firebase query. Path parameters
tableId
integer
required
The numeric table ID to filter by.
curl -X GET http://localhost:3000/orders/table/3 \
  -H "Accept: application/json"
Response 200 OK — same shape as GET /orders but scoped to the given table.
[
  {
    "id": "order_11a2b3",
    "tableId": 3,
    "tableNumber": 3,
    "status": "LISTO",
    "createdAt": 1717201000000,
    "updatedAt": 1717203000000,
    "total": 4500.0
  }
]

POST /orders

Creates a new order and writes it to the orders node in Firebase. The Android client typically calls this after the waiter finishes building the item list and taps “Enviar pedido”. Request body (CreateOrderDto)
tableId
integer
required
ID of the table for this order.
total
number
required
Pre-calculated total amount. Should equal the sum of item.unitPrice × item.quantity for all items.
items
array
required
List of items to include in the order.
curl -X POST http://localhost:3000/orders \
  -H "Content-Type: application/json" \
  -d '{
    "tableId": 3,
    "total": 4500.0,
    "items": [
      {
        "productId": "prod_abc123",
        "quantity": 2,
        "unitPrice": 1500.0,
        "notes": null
      },
      {
        "productId": "prod_xyz789",
        "quantity": 2,
        "unitPrice": 750.0,
        "notes": "sin cebolla"
      }
    ]
  }'
Response 200 OK — returns the newly created OrderDto.
{
  "id": "order_44d5e6",
  "tableId": 3,
  "tableNumber": 3,
  "status": "ENVIADO",
  "createdAt": 1717205000000,
  "updatedAt": 1717205000000,
  "total": 4500.0
}

PUT /orders/{id}/status

Advances or changes an order’s status. This is the primary way the kitchen display, waiter app, and cashier all coordinate on a single order. Path parameters
id
string
required
The order’s unique identifier.
Request body (OrderStatusUpdateRequest)
status
string
required
The new status value. Must be one of: PENDING, ENVIADO, ACEPTADO, EN_PREPARACION, LISTO, ENTREGADO, COMPLETED, CANCELLED.
curl -X PUT http://localhost:3000/orders/order_44d5e6/status \
  -H "Content-Type: application/json" \
  -d '{"status": "ACEPTADO"}'
Response 200 OK — returns the OrderDto with the updated status and a refreshed updatedAt timestamp.
{
  "id": "order_44d5e6",
  "tableId": 3,
  "tableNumber": 3,
  "status": "ACEPTADO",
  "createdAt": 1717205000000,
  "updatedAt": 1717205800000,
  "total": 4500.0
}

Build docs developers (and LLMs) love