Order management is the core operational flow of Ordervista. The system supports three order types — Delivery, Retiro, and Consumo Local — and tracks each order through its status lifecycle from creation to completion. Customers can place and track their own orders, while Operators and Admins have full visibility over all orders and can drive status transitions. Every order creation automatically decrements product stock and generates a linked kitchen command (comanda) in the same database transaction.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.
Order Types
Orders are classified using theTIPOS_PEDIDO table, referenced by id_tipo_pedido on every order:
id_tipo_pedido | Type | Notes |
|---|---|---|
1 | Delivery | Requires a saved delivery address (id_direccion) |
2 | Retiro | Customer collects in person at the restaurant; no address required |
3 | Consumo Local | Created by an Operator or Admin at the counter; id_tipo_pedido is always fixed to 3 |
Order Statuses
Each order has anid_estado that maps to a stage in the ESTADOS_PEDIDO table. The updateOrderStatus controller accepts values [1, 2, 3, 4, 5].
id_estado | Status | Description |
|---|---|---|
1 | Pendiente | Order just created, awaiting kitchen acknowledgement |
2 | En preparación | Kitchen is actively preparing the order |
3 | Listo | Order is ready for pickup or delivery |
4 | Entregado | Order has been handed to the customer |
5 | Cancelled | Accepted by the status validation logic but not seeded as a named status; excluded from sales reports |
Creating a Customer Order
Authenticated customers use this endpoint to place Delivery or Retiro orders. Endpoint:POST /api/ordersAuth: Required (any authenticated user) The server validates each item against live stock, calculates the total server-side (the caller-supplied
total field is ignored), inserts the order and its line items, decrements stock, and creates the COMANDA record — all within a single database transaction.
201 Created
Creating an In-Person Order
Operators and Admins use this endpoint to register walk-in orders at the counter.id_tipo_pedido is automatically set to 3 (Consumo Local) by the server; the caller does not supply it.
Endpoint: POST /api/orders/in-personAuth: Required — Operator or Admin role only
201 Created
Updating Order Status
Operators and Admins advance an order through the lifecycle using aPATCH request. Only valid status IDs [1, 2, 3, 4, 5] are accepted.
Endpoint: PATCH /api/orders/manage/:id/statusAuth: Required — Operator or Admin role only
200 OK
Order Data Schema
PEDIDOS table
| Column | Type | Description |
|---|---|---|
id_pedido | INT | Primary key |
id_usuario | INT | FK → USUARIOS |
id_tipo_pedido | INT | FK → TIPOS_PEDIDO |
id_direccion | INT (nullable) | FK → DIRECCIONES |
id_estado | INT | FK → ESTADOS_PEDIDO |
fecha_pedido | DATETIME | Timestamp of creation |
total | DECIMAL(10,2) | Server-calculated order total |
observacion | VARCHAR(255) | Optional notes |
DETALLE_PEDIDO table
| Column | Type | Description |
|---|---|---|
id_detalle | INT | Primary key |
id_pedido | INT | FK → PEDIDOS |
id_producto | INT | FK → PRODUCTOS |
cantidad | INT | Units ordered |
precio_unitario | DECIMAL(10,2) | Price at time of order (taken from PRODUCTOS at insert time) |
subtotal | DECIMAL(10,2) | cantidad × precio_unitario |
Typical Operator Workflow
Log in as Operator
Navigate to
/login and authenticate with Operator credentials. The JWT is stored in LocalStorage.View all active orders
Open the Operator panel at
/operator. The screen calls GET /api/orders/manage and lists every order across all customers.Create an in-person order (if needed)
Navigate to
/operator/new-order and use the new-order form, which calls POST /api/orders/in-person. A comanda is generated automatically.Advance order status
From the order list, select an order and update its status via
PATCH /api/orders/manage/:id/status — e.g., move it from Pendiente (1) → En preparación (2) → Listo (3) → Entregado (4).