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.

Recetas (recipes) are the connective tissue between Restorante’s kitchen staff and the food items on any given menu. Each recipe names the chef responsible for preparing it, documents the step-by-step process, and carries a list of the ingredients it requires. Because recipes are referenced by Alimento entities, every food item on a menu traces back to a recipe — and through that recipe, to a chef and a set of pantry ingredients.

Recipe Structure

A Receta entity is mapped to the recetas table and has the following fields:
FieldTypeDescription
idIntegerAuto-generated primary key
nombreRecetaString (100 chars, required)The name of the recipe
descripcionProcesoTEXTStep-by-step preparation instructions
chefEmpleadoThe employee (chef) responsible for this recipe (ManyToOne)
ingredientesList<Ingrediente>Ingredients this recipe uses, linked via the receta_ingredientes join table (ManyToMany)
nombreReceta is a non-nullable column. A recipe without a name or without a chef cannot be persisted — the service layer enforces both constraints before calling the repository.

Operations

List All Recipes

Retrieve every recipe in the system, fully hydrated with chef and ingredient data.
GET /api/recetas
Returns a 200 OK list of Receta objects.

Get Recipe by ID

GET /api/recetas/{id}
Returns the matching Receta with its complete data, or 404 Not Found if the ID does not exist.

Get Recipe by Name

Look up a single recipe using its exact nombreReceta value. This endpoint is used internally by the Thymeleaf frontend to pre-load ingredient details for a recipe detail panel.
GET /api/recetas/nombre/{nombre}
Returns the matching Receta, or 404 Not Found if no recipe with that exact name exists.

Get Recipes by Chef

Retrieve all recipes assigned to a specific chef, identified by their numeric employee ID.
GET /api/recetas/chef/{chefId}
Returns a list of Receta objects (empty list if the chef has no assigned recipes).

Recipe Complexity

Rank all recipes by the number of ingredients they contain, from most complex to least complex.
GET /api/recetas/complejidad
Returns a list of RecetaComplejidadDTO objects sorted in descending order by ingredient count. This is useful for meal-planning workflows where kitchen capacity or prep time must be considered before adding a new item to the menu.

Add Ingredient to a Recipe

Link an existing Ingrediente to a recipe by inserting a row into receta_ingredientes.
POST /api/recetas/{recetaId}/ingredientes/{ingredienteId}
Returns 200 OK with "Ingrediente agregado" on success, or 400 Bad Request if either the recipe or ingredient ID does not exist.

Seed Data Reference

The following recipes are included in the application’s seed data:

Pasta Carbonara

Chef: Carina SosaIngredients: Pasta, Queso Parmesano, Huevos, Tocino, Sal, Pimienta

Bistec a la Parrilla

Chef: Andrés MartínezIngredients: Carne de Res, Ajo, Aceite de Oliva, Sal, Pimienta

Ensalada Caprese

Chef: Carina SosaIngredients: Tomate, Mozzarella, Albahaca, Aceite de Oliva, Sal

Pollo al Horno

Chef: Andrés MartínezIngredients: Pollo, Ajo, Aceite de Oliva, Sal, Pimienta

Integration with Menu Creation

When you call POST /api/menu/{menuId}/alimento-completo, the MenuService orchestrates recipe creation as part of a single @Transactional operation:
1

Resolve the Chef

The service calls ChefRepository.findByCedula(chefCedula) using the chefCedula from the request body. If no matching Chef is found, the entire operation is aborted and false is returned.
2

Create the Recipe

A new Receta is instantiated with nombreReceta, descripcionProceso, and the resolved Chef, then persisted to the recetas table.
3

Resolve and Link Ingredients

Each string in ingredientesDescripciones is used to look up an Ingrediente by its descripcion field via IngredienteRepository.findByDescripcion(descripcion). Any match is added to the recipe’s ingredientes collection. Unmatched descriptions are silently skipped.
4

Create the Typed Food Item

The correct Alimento subclass is instantiated based on the tipo field (PLATO_FUERTEPlatoFuerte, POSTREPostres, BEBIDABebida, ADICIONALAdicionales) and linked to the new recipe.
5

Add the Item to the Menu

The new Alimento is persisted and a row is inserted into menu_alimentos, completing the transaction.
Ingredient descriptions in the ingredientesDescripciones array must exactly match the descripcion field of an existing Ingrediente record — the lookup uses an equality check, not a partial or case-insensitive search. Use GET /api/despensa/{id}/ingredientes to retrieve the correct description strings from the pantry before constructing your request.

Further Reading

Build docs developers (and LLMs) love