Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ytabeloved/ordervista/llms.txt

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

A comanda (kitchen command) is an operational ticket automatically generated alongside every order in Ordervista. Its purpose is to give kitchen staff a clear, structured view of what needs to be prepared — including the items ordered, quantities, and any special notes. Because a comanda is created in the same database transaction as its parent order, every order is guaranteed to have exactly one comanda. Operators access the Kitchen Commands screen (/kitchen) to monitor active tickets and coordinate food preparation.

Data Model

Comandas are stored in the COMANDAS table. Each comanda is linked by a unique foreign key to a single order in PEDIDOS, enforcing the one-comanda-per-order constraint at the database level.

COMANDAS table

ColumnTypeDescription
id_comandaINTPrimary key
id_pedidoINT (UNIQUE)FK → PEDIDOS — one comanda per order
fecha_generacionDATETIMETimestamp set automatically on insert (DEFAULT CURRENT_TIMESTAMP)
observacionVARCHAR(255)Special instructions carried over from the order’s observacion field

Listing Commands

Endpoint: GET /api/commands
Auth: Required — Operator or Admin role
Returns all comandas joined with their associated order and customer information. Each entry in the array includes the comanda fields, the linked order header fields, customer details, an item count, and a pipe-delimited text summary of ordered items.
[
  {
    "id_comanda": 31,
    "id_pedido": 47,
    "fecha_generacion": "2025-01-15T14:32:00.000Z",
    "observacion": "Sin cebolla por favor",
    "id_estado": 2,
    "id_tipo_pedido": 1,
    "total": "17000.00",
    "fecha_pedido": "2025-01-15T14:31:55.000Z",
    "cliente_nombre": "Ana García",
    "cliente_email": "ana@example.com",
    "total_items": 2,
    "items_text": "2x Hamburguesa Clásica"
  },
  {
    "id_comanda": 32,
    "id_pedido": 48,
    "fecha_generacion": "2025-01-15T14:45:00.000Z",
    "observacion": "Mesa 4",
    "id_estado": 1,
    "id_tipo_pedido": 3,
    "total": "12000.00",
    "fecha_pedido": "2025-01-15T14:44:50.000Z",
    "cliente_nombre": "Carlos Pérez",
    "cliente_email": "carlos@example.com",
    "total_items": 1,
    "items_text": "1x Papas Fritas"
  }
]

Viewing a Command

Endpoint: GET /api/commands/:id
Auth: Required — Operator or Admin role
Returns the full command detail including the order header fields and a product-level breakdown of every item to be prepared. All fields are returned at the top level — there is no nested order object. Returns 404 if the comanda does not exist. Sample response:
{
  "id_comanda": 31,
  "id_pedido": 47,
  "fecha_generacion": "2025-01-15T14:32:00.000Z",
  "observacion": "Sin cebolla por favor",
  "id_estado": 2,
  "id_tipo_pedido": 1,
  "total": "17000.00",
  "fecha_pedido": "2025-01-15T14:31:55.000Z",
  "cliente_nombre": "Ana García",
  "cliente_email": "ana@example.com",
  "items": [
    {
      "id_detalle": 88,
      "id_producto": 3,
      "nombre": "Hamburguesa Clásica",
      "descripcion": "Carne 200g, lechuga, tomate",
      "cantidad": 2,
      "precio_unitario": "8500.00",
      "subtotal": "17000.00"
    }
  ]
}

Operator UI Workflow

The Kitchen Commands screen at /kitchen is designed for fast operational use:
  1. The operator opens /kitchen — the frontend calls GET /api/commands and renders a list of command tickets, each showing the order number, timestamp, customer name, and observation notes.
  2. The operator selects a ticket to expand it — the frontend calls GET /api/commands/:id to load the full item list for that comanda.
  3. Kitchen staff read off the items and quantities and begin preparation.
  4. Once preparation is complete, the operator returns to the Orders screen (/operator) to advance the order status to Listo (id_estado: 3).

Command Lifecycle

Comandas are created automatically and do not have their own editable status. Their lifecycle is tied to the parent order:
  • Created — automatically when POST /api/orders or POST /api/orders/in-person is called. The observacion from the order body is copied into the comanda at this point.
  • Active — visible on the /kitchen screen while the order is in progress (statuses 1–3).
  • Completed — the order advances to Entregado (4). The comanda record remains in the database for historical reference but the kitchen workflow is considered done.
Because the comanda and its parent order are inserted in the same database transaction, a failure at any point — invalid product, insufficient stock, database error — will roll back both the order and the comanda, leaving the system in a consistent state.

Build docs developers (and LLMs) love