BodegaX does not expose a dedicatedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Edwin950821/BodegaX/llms.txt
Use this file to discover all available pages before exploring further.
/orders endpoint. Instead, order tracking is implemented through the existing sales data model: every dispatched client request becomes a venta (sale) record with associated producto_ventas line items. Understanding this mapping is key to reading the History page correctly, filtering order data by client, and generating end-of-day reports with the TerminarJornada PDF export.
Pending or in-progress crate requests (Solicitar Caja) are tracked exclusively in frontend state — they are not persisted to the backend until an admin confirms the dispatch via Despachar Caja. The backend stores only completed, confirmed orders.
What Is an “Order” in BodegaX?
In BodegaX terminology, a crate request (solicitud de caja) becomes a sale (venta) the moment an admin dispatches it. There is no intermediate “pending order” state in the database. The lifecycle moves from a frontend-only draft directly to a persisted sale record upon admin confirmation. From a data perspective, a fully recorded order consists of:- One
ventarecord — the sale header, capturing the client, admin, total value, and date - One or more
producto_ventarecords — one per product brand included in the order, capturing quantity and subtotal - Updated
productorecords — each product’s stock count is decremented as part of the same dispatch operation
Full Order Lifecycle
The diagram below shows how a client crate request flows through BodegaX from initiation to history and reporting: Step 1 — Client Requests Crates (Solicitar Caja) A user withrole === 'user' opens the Solicitar Caja dialog on the Home page. They specify which beer brands and quantities they need. This step exists only in the Angular frontend — no API call is made yet. The selection is passed as data to the Despachar Caja dialog.
Step 2 — Admin Dispatches (Despachar Caja)
An admin confirms the client’s request. The frontend then executes the following API calls in sequence:
POST /ventas/create— creates the sale header and returns the newuuidPOST /producto-ventas/create— called once for each product withcantidad > 0, using theuuidfrom step 1PUT /productos/edit— called for each product to decrement its stock by the dispatched quantity
GET /ventas/all. The History page fetches all sales, filters by the logged-in user’s UUID if they are a role === 'user', joins client names from GET /admin/all, and joins product names from GET /productos/all via the line items from GET /producto-ventas/all.
Step 4 — End-of-Day PDF Report (TerminarJornada)
An admin opens the TerminarJornada dialog, selects a client, and generates a PDF. The dialog loads the same four endpoints (/admin/all, /ventas/all, /productos/all, /producto-ventas/all) and aggregates quantities and subtotals per product across all sales for the selected client. The PDF is saved locally as Jornada.pdf.
Entity Relationships
The table below shows how the four data entities relate to each other:| Entity | API Source | Key Fields | Relates To |
|---|---|---|---|
usuario (User/Client) | GET /admin/all | uuid, nombre, role | Referenced by venta.uuid_cliente and venta.uuid_admin |
producto (Product) | GET /productos/all | uuid, nombre, precio, stock | Referenced by producto_venta.uuid_producto |
venta (Sale/Order) | GET /ventas/all | uuid, uuid_cliente, uuid_admin, total_venta, fecha | Parent of producto_venta records |
producto_venta (Line Item) | GET /producto-ventas/all | uuid, uuid_producto, uuid_venta, cantidad, total_parcial | Child of venta; references producto |
- A
ventabelongs to one admin (uuid_admin) and one client (uuid_cliente), both resolvable viaGET /admin/all - A
ventahas one or manyproducto_ventas(joined byuuid_venta === venta.uuid) - Each
producto_ventareferences oneproducto(joined byuuid_producto === producto.uuid) - A
productocan appear in manyproducto_ventasacross different sales
Filtering Orders by Client
The backend returns all records fromGET /ventas/all without built-in filtering. To retrieve a specific client’s order history, filter the response array client-side by the client’s UUID:
Complete Dispatch Request Sequence
The following curl sequence demonstrates the full set of API calls that occur during a single Despachar Caja operation in which a client orders 5 crates of Club Colombia and 3 crates of Águila: 1. Create the sale header:"uuid": "f6a7b8c9-d0e1-2345-fabc-456789012345" — used in all subsequent calls.
2. Add the Club Colombia line item:
GET /ventas/all and GET /producto-ventas/all immediately.