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.

Menu management is at the heart of Restorante’s daily operations. Each menu belongs to a Gerente (manager) and holds a curated collection of food items — from main courses and desserts to beverages and add-ons. The menu API lets you inspect the full item list, create richly-detailed food entries in a single request, update them in place, or remove them without losing the underlying record. A Menu entity carries the following fields:
FieldTypeDescription
idIntegerAuto-generated primary key
nombreMenuString (100 chars)Display name of the menu
gerenteGerenteThe manager who owns this menu (ManyToOne)
alimentosList<Alimento>All food items on the menu, linked via the menu_alimentos join table (ManyToMany)
Each item in alimentos is a typed subclass of Alimento:

PlatoFuerte

Main courses — mapped with tipo PLATO_FUERTE.

Postres

Desserts — mapped with tipo POSTRE.

Bebida

Beverages — mapped with tipo BEBIDA.

Adicionales

Add-on extras — mapped with tipo ADICIONAL.
Every Alimento has a nombre (name), precio (BigDecimal), and an optional Receta that links the item to a chef and ingredient list.

Common Operations

1

Get the Full Menu

Retrieve the complete Menu object including its Gerente and all Alimento entries.
GET /api/menu/{id}
Returns a 200 OK with the serialised Menu entity, or 404 Not Found if the menu does not exist.
2

Get Menu Items with Details

Fetch a richer summary of every food item on the menu, including its associated recipe name, chef, and ingredient count.
GET /api/menu/{id}/alimentos
Returns a list of AlimentoDetalleDTO objects sorted alphabetically by food name. See the response shape below for the full field list.
3

Get a Single Food Item

Retrieve one food item from a menu with its full Receta and ingredient data pre-loaded — useful for populating an edit form.
GET /api/menu/{menuId}/alimentos/{alimentoId}
Returns the Alimento entity with its recipe and chef hydrated, or 404 Not Found if either the menu or the item does not exist.
4

Add an Existing Food to the Menu

Link a food item that already exists in the database to a menu. No new records are created; only a row in menu_alimentos is written.
POST /api/menu/{menuId}/alimentos/{alimentoId}
Returns 200 OK with "Alimento agregado correctamente" on success, or 400 Bad Request if either ID is not found.
5

Create a Complete Food Item

Create a recipe, resolve its ingredients by description, create the typed food item, and add it to the menu — all in one atomic transaction.
POST /api/menu/{menuId}/alimento-completo
Request body (AlimentoCompletoRequest):
{
  "nombreAlimento": "Risotto de Setas",
  "precio": 20.00,
  "tipo": "PLATO_FUERTE",
  "nombreReceta": "Risotto Clásico",
  "descripcionProceso": "Sofreír cebolla, agregar arroz arborio, añadir caldo en partes.",
  "chefCedula": "3456789012",
  "ingredientesDescripciones": ["Cebolla", "Mantequilla", "Sal"]
}
The service performs these steps in order:
  1. Looks up the Chef entity by chefCedula — returns 400 if not found.
  2. Creates and persists a new Receta with the given name, process description, and chef.
  3. Resolves each entry in ingredientesDescripciones to an existing Ingrediente by its descripcion field and attaches it to the recipe.
  4. Instantiates the correct Alimento subclass determined by tipo.
  5. Persists the Alimento and inserts the menu_alimentos row.
Returns 200 OK with "Alimento creado correctamente" on success, or 400 Bad Request if any step fails.
6

Update a Food Item

Update the name, price, type, recipe, chef, and ingredient list of an existing food item. If the item had no recipe, one is created. If the tipo changed, the JPA discriminator column is updated via a native SQL query within the same transaction.
PUT /api/menu/{menuId}/alimento-completo/{alimentoId}
The request body uses the same AlimentoCompletoRequest shape as the create endpoint.Returns 200 OK with "Alimento actualizado correctamente" on success, or 400 Bad Request if the alimento or chef is not found.
7

Remove a Food from the Menu

Unlink a food item from the menu by deleting the corresponding row in menu_alimentos. The Alimento record itself is preserved in the database and can be re-linked to any menu later.
DELETE /api/menu/{menuId}/alimentos/{alimentoId}
Returns 200 OK with "Alimento removido del menú" on success, or 400 Bad Request if either ID is not found.

AlimentoCompletoRequest Fields

FieldTypeDescription
nombreAlimentoStringDisplay name of the food item
precioBigDecimalPrice of the item
tipoStringOne of PLATO_FUERTE, POSTRE, BEBIDA, or ADICIONAL
nombreRecetaStringName for the associated recipe
descripcionProcesoStringStep-by-step preparation instructions
chefCedulaStringNational ID of the chef responsible for the recipe
ingredientesDescripcionesList<String>Exact description strings of the ingredients to link

AlimentoDetalleDTO Response Shape

The /api/menu/{id}/alimentos endpoint returns a list of objects with the following fields:
FieldTypeDescription
alimentoIdIntegerPrimary key of the food item
alimentoNombreStringName of the food item
precioBigDecimalPrice
tipoAlimentoStringDerived type string (PLATO_FUERTE, POSTRE, BEBIDA, ADICIONAL)
recetaIdIntegerID of the linked recipe, or null if none
nombreRecetaStringRecipe name, or "Sin receta"
descripcionProcesoStringPreparation description, or "No requiere preparación"
totalIngredientesLongNumber of ingredients on the recipe
chefIdIntegerID of the assigned chef, or null
chefNombreStringChef’s name, or "N/A"
The AlimentoDetalleDTO list returned by GET /api/menu/{id}/alimentos is always sorted alphabetically by alimentoNombre. This ordering is applied in the service layer after mapping and cannot be overridden via query parameters.

Web Interface

The Thymeleaf menu interface at /menu provides a visual view of the same data and calls these same API endpoints under the hood. You can use the web UI to browse items, open an edit modal pre-populated via GET /api/menu/{menuId}/alimentos/{alimentoId}, and submit changes through the REST layer.

Further Reading

Build docs developers (and LLMs) love