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.

Ingredient management spans two controllers. The DespensaController handles the relationship between a pantry and its ingredients — listing, linking, and unlinking. The IngredienteController manages Ingrediente records globally: creating new ingredients, listing all of them, and updating stock levels. None of these endpoints require authentication, and all are CORS-enabled.

GET /api/despensa/{id}/ingredientes

Returns a lightweight list of all ingredients associated with a given pantry, projected as IngredienteDetalleDTO objects. This is preferable to GET /api/despensa/{id} when you only need ingredient data without the full entity graph.
GET /api/despensa/{id}/ingredientes
id
integer
required
The unique identifier of the pantry whose ingredients should be listed.

Request Example

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

Response — 200 OK

Returns an array of IngredienteDetalleDTO objects. The array will be empty if no ingredients are linked to the pantry.
[
  { "ingredienteId": 1, "descripcion": "Tomate",  "cantidadStock": 100 },
  { "ingredienteId": 2, "descripcion": "Cebolla", "cantidadStock": 80  },
  { "ingredienteId": 3, "descripcion": "Ajo",     "cantidadStock": 45  }
]
ingredienteId
integer
Unique identifier of the ingredient.
descripcion
string
Human-readable name of the ingredient (max 100 characters).
cantidadStock
integer
Current stock quantity for this ingredient.

POST /api/despensa/{despensaId}/ingredientes/{ingredienteId}

Links an existing Ingrediente to a Despensa by inserting a row into the despensa_ingredientes join table. Both the pantry and the ingredient must already exist; this endpoint does not create new records.
POST /api/despensa/{despensaId}/ingredientes/{ingredienteId}
despensaId
integer
required
The unique identifier of the target pantry.
ingredienteId
integer
required
The unique identifier of the ingredient to link to the pantry.

Request Example

curl -X POST \
  http://localhost:8080/api/despensa/1/ingredientes/5

Responses

StatusBodyCondition
200 OK"Ingrediente agregado"The ingredient was successfully linked to the pantry.
400 Bad Request"No se pudo agregar"The pantry ID or ingredient ID does not exist.

DELETE /api/despensa/{despensaId}/ingredientes/{ingredienteId}

Removes the association between an ingredient and a pantry by deleting the corresponding row from the despensa_ingredientes join table. The Ingrediente record itself is not deleted — it remains available for use in other pantries or recipes.
DELETE /api/despensa/{despensaId}/ingredientes/{ingredienteId}
despensaId
integer
required
The unique identifier of the pantry from which the ingredient should be removed.
ingredienteId
integer
required
The unique identifier of the ingredient to unlink.

Request Example

curl -X DELETE \
  http://localhost:8080/api/despensa/1/ingredientes/5

Responses

StatusBodyCondition
200 OK"Ingrediente eliminado"The ingredient was successfully unlinked from the pantry.
400 Bad Request"No se pudo eliminar"The pantry ID or ingredient ID does not exist.

Ingrediente API

The IngredienteController manages Ingrediente records system-wide under /api/ingredientes.

GET /api/ingredientes

Returns every Ingrediente in the database, regardless of which pantry it belongs to.
curl http://localhost:8080/api/ingredientes
[
  { "id": 1, "descripcion": "Tomate",    "cantidadStock": 100 },
  { "id": 2, "descripcion": "Cebolla",   "cantidadStock": 80  },
  { "id": 3, "descripcion": "Albahaca",  "cantidadStock": 25  }
]

POST /api/ingredientes

Creates a new Ingrediente record. The created record is returned in the response with its assigned id. After creating an ingredient you can link it to a pantry using the POST /api/despensa/{despensaId}/ingredientes/{ingredienteId} endpoint above.
descripcion
string
required
Human-readable name of the ingredient. Maximum 100 characters. Must not be blank.
cantidadStock
integer
required
Initial stock quantity. Must be zero or greater.
curl -X POST http://localhost:8080/api/ingredientes \
  -H "Content-Type: application/json" \
  -d '{ "descripcion": "Arroz", "cantidadStock": 100 }'
{ "id": 17, "descripcion": "Arroz", "cantidadStock": 100 }

PUT /api/ingredientes/{id}/stock

Replaces the cantidadStock value for an ingredient with the supplied value. This is an absolute set operation, not a delta — pass the desired final stock quantity, not an increment or decrement.
id
integer
required
The unique identifier of the ingredient whose stock should be updated.
stock
integer
required
The new stock quantity to set. Must be zero or greater; negative values are rejected.
curl -X PUT \
  "http://localhost:8080/api/ingredientes/1/stock?stock=150"
StatusBodyCondition
200 OK"Stock actualizado"Stock was updated successfully.
400 Bad Request"No se pudo actualizar"The ingredient ID does not exist, or stock is negative.

Build docs developers (and LLMs) love