Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/EstefanoARG/FridgeRadar/llms.txt

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

The inventory is the heart of FridgeRadar. Each entry represents a specific product placed on a specific shelf inside a household, and is enriched with purchase date, expiry date, quantity, and a live freshness state. Whenever an item is added, edited, or removed the system automatically records a corresponding movement entry, giving you a complete audit trail of how your pantry stock has changed over time.

Inventory Item Fields

Every item in the pantry is represented by an InventarioResponse object.
FieldTypeDescription
id_inventariointAuto-generated primary key
id_hogarintThe household this item belongs to
id_productointReference to the product catalogue entry
id_estanteintThe shelf where the item physically sits
id_usuario_agregointThe user who added the item
cantidadfloatCurrent quantity on hand
fecha_compradate | nullWhen the item was purchased
fecha_vencimientodate | nullBest-before or use-by date
abiertoboolWhether the package has been opened
observacionesstr | nullFree-text notes (e.g. “half used”)
estado_caducidadstrComputed freshness state — see Semáforo
fecha_registrodatetimeWhen the record was first created

Adding an Item

When creating an item you supply only the fields you know; estado_caducidad is always computed server-side and never accepted as input.
POST /api/v1/inventario/hogar/{id_hogar}
Authorization: Bearer <token>
Content-Type: application/json

{
  "id_producto": 42,
  "id_estante": 7,
  "cantidad": 2.0,
  "fecha_compra": "2024-11-10",
  "fecha_vencimiento": "2024-11-17",
  "abierto": false,
  "observaciones": "Comprado en oferta"
}
{
  "id_inventario": 101,
  "id_hogar": 1,
  "id_producto": 42,
  "id_estante": 7,
  "id_usuario_agrego": 3,
  "cantidad": 2.0,
  "fecha_compra": "2024-11-10",
  "fecha_vencimiento": "2024-11-17",
  "abierto": false,
  "observaciones": "Comprado en oferta",
  "estado_caducidad": "amarillo",
  "fecha_registro": "2024-11-10T14:22:00"
}

The estado_caducidad Field

estado_caducidad is a computed, read-only field on every inventory response. It is derived from fecha_vencimiento by the semáforo engine and can hold one of four values:
ValueMeaning
"verde"Fresh — more than 7 days remaining, or no expiry date set
"amarillo"Use soon — 3 to 7 days remaining
"rojo"Use immediately — 0 to 2 days remaining
"vencido"Expired — past the expiry date
See The Semáforo for the full threshold logic and how states are recalculated daily.

The abierto Flag

Setting abierto: true signals that a package has been opened. An opened item may have a shorter effective shelf life than the printed expiry date, so the flag is surfaced prominently in the UI and can be used to filter or prioritise items.
PATCH /api/v1/inventario/{id_inventario}
Authorization: Bearer <token>
Content-Type: application/json

{
  "abierto": true,
  "observaciones": "Abierto el 12/11 — usar antes de 3 días"
}
Opening a package does not automatically change fecha_vencimiento. Update that field manually if the manufacturer’s guidance changes once opened.

Inventory Movements

Every write operation on an inventory item generates a MovimientoInventario record. This gives admins and household members a tamper-evident log of all stock changes.
FieldTypeDescription
id_movimientointAuto-generated primary key
id_inventariointThe inventory item that changed
id_usuariointWho triggered the change
tipo_movimientostrType of change ("entrada", "salida", "ajuste", "eliminacion")
cantidadfloat | nullThe quantity involved in the movement
descripcionstr | nullHuman-readable summary of what changed
fecha_movimientodatetimeExact timestamp of the event
Movements are created automatically by the service layer. You do not post to a movements endpoint directly — they appear as a side-effect of POST, PATCH, and DELETE calls on /api/v1/inventario/.

Fetching Movements

GET /api/v1/inventario/{id_inventario}/movimientos
Authorization: Bearer <token>

Filtering Inventory by Freshness State

The household inventory list endpoint accepts an optional estado query parameter so you can fetch only the items at a particular freshness level.
GET /api/v1/inventario/hogar/{id_hogar}?estado=rojo
Authorization: Bearer <token>
Accepted values for estado:
ValueReturns
verdeItems fresh with more than 7 days remaining
amarilloItems expiring in 3–7 days
rojoItems expiring in 0–2 days
vencidoItems that are already past their expiry date
Omitting the estado parameter returns all items regardless of freshness state.
Combine the ?estado=amarillo and ?estado=rojo filters with the Tengo Hambre recipe engine to surface meals you can cook from items that need to be used up first.

API Overview

MethodPathDescription
POST/api/v1/inventario/hogar/{id_hogar}Add a new item
GET/api/v1/inventario/hogar/{id_hogar}List all items (supports ?estado=)
GET/api/v1/inventario/{id_inventario}Get a single item
PATCH/api/v1/inventario/{id_inventario}Update quantity, shelf, expiry, or notes
DELETE/api/v1/inventario/{id_inventario}Remove an item
GET/api/v1/inventario/{id_inventario}/movimientosList movement history

Build docs developers (and LLMs) love