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.

This is the primary endpoint for adding new food to a menu when the food record does not yet exist. In a single transactional call, the server performs the following steps in order: looks up the chef by cédula, creates and saves a new Receta, links matching Ingrediente records to that recipe by their description strings, instantiates the correct Alimento subclass based on the requested type, saves the food item, and finally associates it with the target menu via the menu_alimentos join table. If any step fails, the entire operation returns 400 and no partial data is committed.

Endpoint

POST /api/menu/{menuId}/alimento-completo

Path parameters

menuId
integer
required
The primary key of the menu to which the new food item will be added after creation.

Request body

Content-Type: application/json
nombreAlimento
string
required
Display name of the new food item. Maximum 100 characters. Stored in the nombre column of the alimentos table.
precio
number
required
Price of the food item as a decimal value. Stored as DECIMAL(10,2).
tipo
string
required
Food category. Determines which JPA subclass is instantiated and sets the tipo_alimento discriminator column. Accepted values:
  • PLATO_FUERTE — main course
  • POSTRE — dessert
  • BEBIDA — beverage
  • ADICIONAL — side or add-on
  • GENERAL — base Alimento with no subtype
nombreReceta
string
required
Name of the new recipe that will be created and linked to this food item.
descripcionProceso
string
Free-text preparation process description stored on the Receta entity.
chefCedula
string
required
The cédula (national ID number) of the chef who will be assigned as the recipe’s owner. The server resolves this to a Chef entity via an exact match. The request fails with 400 if no matching chef is found.
ingredientesDescripciones
string[]
Array of ingredient description strings. Each entry is matched against the descripcion field of existing Ingrediente records. Only exact matches are linked to the new recipe; non-matching strings are silently skipped.

Responses

StatusBodyDescription
200 OK"Alimento creado correctamente"The food item, recipe, and all associations were created successfully.
400 Bad Request"No se pudo crear el alimento"The operation failed, most commonly because the chef cédula was not found or an unexpected error occurred.

Example request

curl -X POST http://localhost:8080/api/menu/1/alimento-completo \
  -H "Content-Type: application/json" \
  -d '{
    "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"]
  }'

Example responses

Success — 200 OK
Alimento creado correctamente
Failure — 400 Bad Request
No se pudo crear el alimento
Each string in ingredientesDescripciones must exactly match the descripcion field of an existing Ingrediente record — including capitalisation and spacing. Strings that do not match any record are silently skipped without returning an error, so the recipe may end up with fewer ingredients than expected if the values are misspelled.
If the chefCedula value does not match any chef in the database, the endpoint returns 400 Bad Request and no records are created. Verify the chef’s cédula with the Chefs API before calling this endpoint.

Build docs developers (and LLMs) love