Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/luisllatas-dev/Proyecto_Pasteleria_DonMamino/llms.txt

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

The Inventory API tracks stock levels for each product at each bakery location. Every record links a product (id_producto) to a location (id_sede) and stores both the current quantity on hand and the minimum acceptable quantity. When cantidad_actual falls below cantidad_minima, the system considers the product eligible for a restocking alert. All five endpoints require a valid JWT Bearer token.
Every endpoint on this page requires a valid JWT token. Include the token in the Authorization header as Bearer <token> on every request.

GET /api/inventario

Returns a list of all inventory records across all products and locations. Auth required: Yes

Response fields

id_inventario
number
Unique identifier for the inventory record.
id_producto
number
ID of the product this record tracks. References the Productos table.
id_sede
number
ID of the bakery location where this stock is held. References the Sedes table.
cantidad_actual
number
Current quantity of the product available at this location.
cantidad_minima
number
Minimum quantity threshold. When cantidad_actual drops below this value, the product should be restocked.
curl --request GET \
  --url http://localhost:3000/api/inventario \
  --header 'Authorization: Bearer <token>'
Example response
[
  {
    "id_inventario": 1,
    "id_producto": 4,
    "id_sede": 1,
    "cantidad_actual": 80,
    "cantidad_minima": 20
  },
  {
    "id_inventario": 2,
    "id_producto": 7,
    "id_sede": 2,
    "cantidad_actual": 12,
    "cantidad_minima": 15
  }
]
In the example above, the second record has cantidad_actual (12) below cantidad_minima (15), indicating that product 7 at location 2 needs restocking.

GET /api/inventario/:id

Returns a single inventory record by its unique ID. Auth required: Yes

Path parameters

id
number
required
The id_inventario of the record to retrieve.

Response fields

id_inventario
number
Unique identifier for the inventory record.
id_producto
number
ID of the product this record tracks.
id_sede
number
ID of the bakery location where this stock is held.
cantidad_actual
number
Current quantity available at this location.
cantidad_minima
number
Minimum quantity threshold before a restocking alert is triggered.
curl --request GET \
  --url http://localhost:3000/api/inventario/1 \
  --header 'Authorization: Bearer <token>'
Example response
{
  "id_inventario": 1,
  "id_producto": 4,
  "id_sede": 1,
  "cantidad_actual": 80,
  "cantidad_minima": 20
}

Error responses

StatusDescription
404No record found with the given ID. Response body: { "message": "Registro de inventario no encontrado" }
500Internal server error.

POST /api/inventario

Creates a new inventory record for a product at a specific location. Auth required: Yes

Request body

id_producto
number
required
ID of the product to track. Must reference an existing record in the Productos table.
id_sede
number
required
ID of the bakery location where the stock is held. Must reference an existing record in the Sedes table.
cantidad_actual
number
required
Initial stock quantity available at this location.
cantidad_minima
number
required
Minimum quantity threshold. When cantidad_actual falls below this value, the product is flagged for restocking.

Response fields

id
number
The auto-generated id_inventario of the newly created record.
mensaje
string
Confirmation message: "Registro de inventario creado exitosamente".
curl --request POST \
  --url http://localhost:3000/api/inventario \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id_producto": 5,
    "id_sede": 1,
    "cantidad_actual": 50,
    "cantidad_minima": 10
  }'
Example response
{
  "id": 3,
  "mensaje": "Registro de inventario creado exitosamente"
}

PUT /api/inventario/:id

Updates all fields of an existing inventory record. All body fields must be provided. Auth required: Yes

Path parameters

id
number
required
The id_inventario of the record to update.

Request body

id_producto
number
required
Updated product ID for this inventory record.
id_sede
number
required
Updated location ID for this inventory record.
cantidad_actual
number
required
Updated current stock quantity.
cantidad_minima
number
required
Updated minimum quantity threshold.

Response fields

mensaje
string
Confirmation message: "Registro de inventario actualizado exitosamente".
curl --request PUT \
  --url http://localhost:3000/api/inventario/1 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id_producto": 4,
    "id_sede": 1,
    "cantidad_actual": 95,
    "cantidad_minima": 20
  }'
Example response
{
  "mensaje": "Registro de inventario actualizado exitosamente"
}

Error responses

StatusDescription
404No record found with the given ID. Response body: { "message": "Registro de inventario no encontrado" }
500Internal server error.

DELETE /api/inventario/:id

Permanently deletes an inventory record. Auth required: Yes

Path parameters

id
number
required
The id_inventario of the record to delete.

Response fields

mensaje
string
Confirmation message: "Registro de inventario eliminado exitosamente".
This action is permanent. Deleted inventory records cannot be recovered.
curl --request DELETE \
  --url http://localhost:3000/api/inventario/1 \
  --header 'Authorization: Bearer <token>'
Example response
{
  "mensaje": "Registro de inventario eliminado exitosamente"
}

Error responses

StatusDescription
404No record found with the given ID. Response body: { "message": "Registro de inventario no encontrado" }
500Internal server error.

Build docs developers (and LLMs) love