Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ierinconc/billar-pro-backend/llms.txt

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

The products (productos) API manages the catalog of items — drinks, snacks, and anything else sold at the tables — that staff can record as consumptions during an active session. Each product carries a price and an availability flag so that seasonal or out-of-stock items can be hidden from the point-of-sale without permanently removing their history from past consumption records.

Endpoints

GET /api/productos

Returns the complete product catalog, both available and unavailable items. Authentication: Required — include a valid JWT Bearer token. Response: 200 OK — array of Producto objects.
id
Long
Auto-generated primary key.
nombre
String
Display name of the product, e.g. "Gaseosa".
categoria
String
Free-text category label, e.g. "Bebidas" or "Snacks".
precio
Double
Unit price in local currency.
disponible
Boolean
true if the product is currently available for sale; false hides it from active menus while preserving historical data.

Request example

curl -X GET http://localhost:8080/api/productos \
  -H "Authorization: Bearer <token>"

GET /api/productos/{id}

Returns a single product by its primary key. Authentication: Required — include a valid JWT Bearer token. Path parameters:
id
Long
required
Primary key of the product to retrieve.
Response: 200 OK — Producto object. Errors:
StatusMeaning
404No product with that id exists.

Request example

curl -X GET http://localhost:8080/api/productos/5 \
  -H "Authorization: Bearer <token>"

POST /api/productos

Creates a new product in the catalog. Authentication: Required — include a valid JWT Bearer token. Request body (JSON):
nombre
string
required
Display name for the product. Must not be blank.
categoria
string
required
Category label for grouping on the menu, e.g. "Bebidas", "Snacks", "Licores".
precio
double
required
Unit price in local currency. Must be a positive number.
disponible
boolean
required
Pass true to make the product immediately available for consumptions; false to add it in a hidden state.
Response: 201 Created — the newly created Producto object including its generated id.

Request example

curl -X POST http://localhost:8080/api/productos \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Gaseosa",
    "categoria": "Bebidas",
    "precio": 2500.0,
    "disponible": true
  }'

Response example

{
  "id": 8,
  "nombre": "Gaseosa",
  "categoria": "Bebidas",
  "precio": 2500.0,
  "disponible": true
}

PUT /api/productos/{id}

Replaces all fields of an existing product. All four body fields must be supplied — this is a full replacement, not a partial update. Authentication: Required — include a valid JWT Bearer token. Path parameters:
id
Long
required
Primary key of the product to update.
Request body (JSON):
nombre
string
required
New display name.
categoria
string
required
New category label.
precio
double
required
New unit price. Changing the price does not retroactively affect closed-session subtotals, which were computed at registration time.
disponible
boolean
required
Updated availability flag.
Response: 200 OK — the updated Producto object. Errors:
StatusMeaning
404No product with that id exists.

Request example

curl -X PUT http://localhost:8080/api/productos/8 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Gaseosa 500ml",
    "categoria": "Bebidas",
    "precio": 3000.0,
    "disponible": true
  }'

DELETE /api/productos/{id}

Permanently removes a product from the catalog. Authentication: Required — include a valid JWT Bearer token. Path parameters:
id
Long
required
Primary key of the product to delete.
Response: 204 No Content — empty body on success. Errors:
StatusMeaning
404No product with that id exists.

Request example

curl -X DELETE http://localhost:8080/api/productos/8 \
  -H "Authorization: Bearer <token>"

Deleting a product that already appears in historical consumptions will break those records — the foreign key producto_id in the consumos table will reference a row that no longer exists. Prefer setting disponible: false to remove the product from active sale without destroying sales history.
Use disponible: false to temporarily pull a product off the menu — for example when a drink is out of stock — and flip it back to true when it is restocked. This preserves the full consumption history and avoids the need to re-create the product with a new id.

Build docs developers (and LLMs) love