Skip to main content

Documentation 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.

The Products API manages the BodegaX beer catalog — every brand stocked in the warehouse is represented as a producto record with a name, price per crate, and current stock count. These two endpoints are used across nearly every frontend view: the Home page builds its sales table from the product list, the Management page displays total inventory, the Despachar Caja dialog lets admins select quantities to dispatch, and the RecibirCaja dialog increments stock when a new shipment arrives.

GET /productos/all

Returns the complete list of beer products in the warehouse along with their current stock counts and prices. This is the primary read endpoint and is called on initialization by the Home, Management, History, and TerminarJornada components.
curl http://localhost:8080/productos/all

Response

An array of product objects.
uuid
string
Universally unique identifier for the product. Used as the reference key in product-sale line items (uuid_producto) and in stock update requests.
nombre
string
The beer brand or product name (for example, "Club Colombia" or "Águila"). Displayed in the sales table, inventory view, and PDF reports.
precio
number
Price per crate, in the warehouse’s local currency. Used by the frontend to compute total_parcial and total_venta when creating a sale.
stock
number
Current number of crates available in the warehouse. Decremented automatically after each successful dispatch (Despachar Caja) and incremented when a shipment is received (RecibirCaja).
Example response:
[
  {
    "uuid": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "nombre": "Club Colombia",
    "precio": 85000,
    "stock": 120
  },
  {
    "uuid": "d4e5f6a7-b8c9-0123-defa-234567890123",
    "nombre": "Águila",
    "precio": 72000,
    "stock": 85
  },
  {
    "uuid": "e5f6a7b8-c9d0-1234-efab-345678901234",
    "nombre": "Poker",
    "precio": 68000,
    "stock": 200
  }
]
The History page and TerminarJornada dialog use this endpoint to resolve product UUIDs to human-readable names. Each producto-venta record stores only the uuid_producto; the frontend joins against this list to display the brand name in reports and history tables.

PUT /productos/edit

Updates a product record. This endpoint is used for two distinct operations in BodegaX:
  1. Stock decrement after a sale — called by the Despachar Caja dialog for each dispatched product. The new stock is computed as p.stock - p.quantity before the request is sent.
  2. Stock increment after receiving inventory — called by the RecibirCaja dialog. The new stock is computed as selected.stock + quantity and the entire updated product object is sent as the body.
This endpoint replaces the entire product record on the server. Always pass uuid, nombre, precio, and stock together — omitting any field may result in that field being cleared or overwritten with a default value on the server side.

Despachar Caja — Stock Decrement

curl -X PUT http://localhost:8080/productos/edit \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "nombre": "Club Colombia",
    "precio": 85000,
    "stock": 108
  }'
In this example, 12 crates were sold from a previous stock of 120, leaving 108.

RecibirCaja — Stock Increment

curl -X PUT http://localhost:8080/productos/edit \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "nombre": "Club Colombia",
    "precio": 85000,
    "stock": 158
  }'
In this example, 50 crates were received and added to the current stock of 108, yielding 158.

Request Body

uuid
string
required
The unique identifier of the product to update. Obtained from the GET /productos/all response.
nombre
string
required
The product’s brand name. Pass the existing value unchanged if only stock is being updated.
precio
number
required
Price per crate. Pass the existing value unchanged if only stock is being updated.
stock
number
required
The new total stock count. The frontend calculates this value before sending — the API accepts the final count, not a delta.

Response

The updated product object reflecting the new values.
{
  "uuid": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "nombre": "Club Colombia",
  "precio": 85000,
  "stock": 108
}
During a Despachar Caja operation, PUT /productos/edit is called for every product in the sale that has a quantity greater than zero. These calls run concurrently in the frontend after each POST /producto-ventas/create completes. If a call fails mid-dispatch, the stock count may become inconsistent with the sale record. Monitor server logs after failed dispatch operations.

Build docs developers (and LLMs) love