Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/NicolasMPP/restorante-springboot/llms.txt

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

The Pantry Statistics endpoint returns a single DespensaEstadisticas object that summarises the inventory health of a pantry without listing every ingredient individually. It is designed for dashboards and quick status checks: one HTTP call tells you whether the pantry has any critical shortages (sinStock) or items approaching depletion (stockBajo) alongside the overall item count. All counts are computed server-side from the pantry’s current IngredienteDetalleDTO projection.

Endpoint

GET /api/despensa/{id}/estadisticas

Path Parameters

id
integer
required
The unique identifier of the pantry for which statistics should be calculated. Must correspond to an existing Despensa record.

Request Example

curl http://localhost:8080/api/despensa/1/estadisticas

Response — 200 OK

Returns a DespensaEstadisticas JSON object.
{
  "totalIngredientes": 16,
  "conStock": 16,
  "stockBajo": 0,
  "sinStock": 0
}

Response Fields

totalIngredientes
integer
The total number of Ingrediente records currently associated with this pantry. Equivalent to the length of the array returned by GET /api/despensa/{id}/ingredientes.
conStock
integer
The number of ingredients whose cantidadStock is greater than zero. This includes items flagged as stockBajo — an ingredient is counted in conStock as long as at least one unit remains.
stockBajo
integer
The number of ingredients with 0 < cantidadStock < 10. These items still have some stock but are approaching depletion under the fixed internal threshold of 10 units.
sinStock
integer
The number of ingredients with cantidadStock = 0. These items are completely out of stock and need immediate replenishment.

Business Logic

The four fields relate to each other as follows:
  • totalIngredientes = conStock + sinStock
  • conStock includes both fully-stocked ingredients and those flagged as stockBajo
  • An ingredient counted in stockBajo is also counted in conStock
totalIngredientes
├── conStock  (cantidadStock > 0)
│   ├── stockBajo  (0 < cantidadStock < 10)
│   └── (normal stock — cantidadStock ≥ 10)
└── sinStock  (cantidadStock = 0)
The stockBajo field uses a fixed threshold of 10 units (cantidadStock < 10) that is hardcoded in DespensaService. This value cannot be changed via the API. If you need low-stock detection with a custom threshold, use GET /api/despensa/{id}/stock-bajo?umbral={n}, which accepts the threshold as a query parameter at runtime.

Build docs developers (and LLMs) love