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 Ingredientes API manages the shared pool of ingredients used by recipes and the pantry (despensa). All ingredient records live in a single ingredientes table and can be referenced by multiple recipes simultaneously through a many-to-many join. The base path for ingredient management is /api/ingredientes. This page also covers the Alimentos standalone API at /api/alimentos, which handles the food-item catalogue independently of the full menu workflow. Both APIs are CORS-enabled with no authentication required.

Ingredientes API — /api/ingredientes

List all ingredients


GET /api/ingredientes Returns the complete list of Ingrediente records. Each record exposes only its own scalar fields; back-references to recipes and pantry entries are suppressed (@JsonIgnore) to avoid circular serialisation.
curl http://localhost:8080/api/ingredientes
Response — 200 OK
[
  { "id": 1, "descripcion": "Tomate",   "cantidadStock": 100 },
  { "id": 2, "descripcion": "Cebolla",  "cantidadStock": 80  },
  { "id": 3, "descripcion": "Ajo",      "cantidadStock": 50  },
  { "id": 4, "descripcion": "Pasta",    "cantidadStock": 120 }
]

Response fields

id
integer
Auto-generated primary key of the ingredient.
descripcion
string
Human-readable name or description of the ingredient (max 100 characters).
cantidadStock
integer
Current stock level on hand (must be ≥ 0).

Create an ingredient


POST /api/ingredientes Persists a new Ingrediente record. The response body is the saved entity including the database-assigned id.

Request body

descripcion
string
required
Name or description of the ingredient. Must not be blank and must be 100 characters or fewer.
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": 80 }'
Response — 200 OK
{
  "id": 5,
  "descripcion": "Arroz",
  "cantidadStock": 80
}

Update stock level


PUT /api/ingredientes/{id}/stock Replaces the cantidadStock value of an existing ingredient with the value supplied via query parameter. This is the preferred way to record deliveries or inventory corrections without needing to re-POST the full entity.

Path parameters

id
integer
required
The primary key of the ingredient whose stock should be updated.

Query parameters

stock
integer
required
The new absolute stock quantity to set (must be ≥ 0).
Response — 200 OK
"Stock actualizado"
Response — 400 Bad Request (ingredient not found or update failed)
"No se pudo actualizar"
curl -X PUT "http://localhost:8080/api/ingredientes/1/stock?stock=150"

Alimentos API — /api/alimentos

The Alimentos API gives direct CRUD access to food items without going through the full menu workflow. Use it for simple lookups, lightweight admin tasks, or when you need to delete a food item entirely from the system.

List all food items


GET /api/alimentos Returns every Alimento record, including subtypes (PlatoFuerte, Postres, Bebida, Adicionales) stored under SINGLE_TABLE inheritance. The discriminator column (tipo_alimento) is not serialised in the JSON response.
curl http://localhost:8080/api/alimentos
Response — 200 OK
[
  { "id": 1, "nombre": "Spaghetti Carbonara", "precio": 12.50 },
  { "id": 2, "nombre": "Tiramisú",            "precio": 5.75  },
  { "id": 3, "nombre": "Agua Mineral",        "precio": 1.50  }
]

Get food item by ID


GET /api/alimentos/{id} Fetches a single Alimento by its primary key.

Path parameters

id
integer
required
The numeric identifier of the food item to retrieve.
curl http://localhost:8080/api/alimentos/1
Returns 404 Not Found when no food item exists with the given id.

Search food items by name


GET /api/alimentos/buscar Returns all food items whose nombre field contains the provided search string, case-insensitive. Useful for autocomplete inputs and admin search bars.

Query parameters

nombre
string
required
Substring to search for within food item names. The match is case-insensitive and does not require an exact word boundary.
curl "http://localhost:8080/api/alimentos/buscar?nombre=pasta"
Response — 200 OK — array of matching Alimento objects (empty array [] if no match found).

Create a basic food item


POST /api/alimentos Persists a new Alimento directly, bypassing the recipe-creation workflow. The receta field is optional; if omitted the food item will have no linked recipe.

Request body

nombre
string
required
Display name of the food item (max 100 characters).
precio
number
required
Unit price with up to two decimal places. Must be greater than zero.
receta
object
Optional linked recipe object. Provide at minimum { "id": <recetaId> } to associate an existing recipe.
curl -X POST http://localhost:8080/api/alimentos \
  -H "Content-Type: application/json" \
  -d '{ "nombre": "Ensalada César", "precio": 8.00 }'
Response — 200 OK — the saved Alimento with its assigned id.

Delete a food item


DELETE /api/alimentos/{id} Permanently removes an Alimento record from the database.

Path parameters

id
integer
required
The numeric identifier of the food item to delete.
curl -X DELETE http://localhost:8080/api/alimentos/3
Response — 200 OK
"Alimento eliminado"
Returns 400 Bad Request when no food item with the given id exists.
This endpoint permanently deletes the Alimento record from the system. If you only want to remove a food item from a specific menu without deleting it entirely, use DELETE /api/menu/{menuId}/alimentos/{alimentoId} instead, which only breaks the menu-alimento association.

Sample Ingrediente record

{
  "id": 1,
  "descripcion": "Tomate",
  "cantidadStock": 100
}

Build docs developers (and LLMs) love