platos) within a transaction. Each item belongs to exactly one transaction and must reference either a producto_id or a plato_id — never both.
POST /api/transacciones/:id/items
Adds a product or dish to the transaction. The server automatically resolves precio_unitario from the current price on the product or dish record — you do not pass it in the request body. If the transaction is cerrado, it is reopened automatically before the item is added.
Adding a plato_id item also sets estado_cocina to pendiente and broadcasts the update to the kitchen via WebSocket.
Authentication: Required
Required role: Any authenticated user
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer <token> | Yes |
| Content-Type | application/json | Yes |
Path parameters
| Parameter | Type | Description |
|---|---|---|
| id | number | The transaction ID |
Body
ID of the product to add. Mutually exclusive with
plato_id.ID of the dish to add. Mutually exclusive with
producto_id.Quantity to add. Must be ≥ 0.01.
Free-text preparation notes for this item (e.g.
"Sin cebolla, punto medio").Optional list of extras to attach at creation time. Each extra follows the AddExtraDto schema.
Extra object shape
| Field | Type | Required | Description |
|---|---|---|---|
| ingrediente_id | string | — | Inventory ingredient ID. Mutually exclusive with descripcion. |
| descripcion | string | — | Free-text description (e.g. "Extra queso"). Mutually exclusive with ingrediente_id. |
| precio | number | Yes | Price of the extra. |
| cantidad | number | — | Quantity. Defaults to 1. |
Response
Success (201)
Auto-generated item ID.
Parent transaction ID.
Associated product ID.
Associated dish ID.
Quantity as a decimal string.
Unit price resolved from the product or dish.
Line total (
precio_unitario × cantidad + extras). Recalculated whenever extras change.Preparation notes.
Error responses
| Status | Description |
|---|---|
| 400 | Both producto_id and plato_id provided, or neither provided |
| 401 | Unauthorized |
| 404 | Transaction, product, or dish not found |
GET /api/transacciones/:id/items
Returns all active (non-deleted) items for the specified transaction, enriched with the product or dish name.
Authentication: Required
Required role: Any authenticated user
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer <token> | Yes |
Path parameters
| Parameter | Type | Description |
|---|---|---|
| id | number | The transaction ID |
Response
Success (200)
An array of item objects:Item ID.
Parent transaction ID.
Product ID.
Dish ID.
Resolved product or dish name.
Quantity.
Unit price.
Line total.
Preparation notes.
DELETE /api/transacciones/:id/items/:itemId
Soft-deletes an item from the transaction. The transaction’s monto_total is recalculated automatically after deletion.
Authentication: Required
Required role: Any authenticated user
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer <token> | Yes |
Path parameters
| Parameter | Type | Description |
|---|---|---|
| id | number | The transaction ID |
| itemId | number | The item ID |
Response
Success (200)
Confirmation message.
Error responses
| Status | Description |
|---|---|
| 401 | Unauthorized |
| 404 | Transaction or item not found |