This endpoint updates an existing food item and its associated recipe in a single transactional call. It accepts the sameDocumentation 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.
AlimentoCompletoRequest body as the create endpoint. Changing the tipo (food category) is fully supported: because Hibernate does not modify the JPA single-table inheritance discriminator column on a regular merge, Restorante issues a native SQL UPDATE on the tipo_alimento column when the type differs from the current value. If the food item had no recipe at the time of the update, a new Receta is created automatically. If a recipe already exists, its name, process description, chef, and full ingredient list are replaced.
Endpoint
PUT/api/menu/{menuId}/alimento-completo/{alimentoId}
Path parameters
The primary key of the menu that contains the food item. Provided for routing context — the update operates on the food item directly.
The primary key of the food item to update.
Request body
Content-Type:application/json — same AlimentoCompletoRequest DTO used by the create endpoint.
Updated display name of the food item. Maximum 100 characters.
Updated price of the food item as a decimal value. Stored as
DECIMAL(10,2).Updated food category. If the value differs from the current discriminator value in the database, the server issues a native SQL
UPDATE on the tipo_alimento column within the same transaction. Accepted values:PLATO_FUERTEPOSTREBEBIDAADICIONALGENERAL
Updated name for the recipe. If the food item had no recipe, a new one is created with this name.
Updated preparation process description stored on the
Receta entity.The cédula of the chef to assign as recipe owner. Looked up by exact match. Returns
400 if not found.The complete new list of ingredient descriptions. The existing ingredient associations on the recipe are cleared and fully replaced with this list. Each string is matched against the
descripcion field of existing Ingrediente records — non-matching strings are silently skipped.Update behaviour
The service applies changes in the following sequence:- Looks up the
AlimentobyalimentoId— returns400if not found. - Saves the updated
nombreandpreciofields. - Compares the requested
tipowith the current discriminator value. If they differ, runs a native SQL update ontipo_alimento. - Looks up the chef by
chefCedula— returns400if not found. - If the food item has an existing
Receta: updatesnombreReceta,descripcionProceso, andchef; clears the ingredient list and re-populates it fromingredientesDescripciones. - If the food item has no
Receta: creates a new one with the provided fields and links it to the food item.
Responses
| Status | Body | Description |
|---|---|---|
200 OK | "Alimento actualizado correctamente" | All fields were updated successfully. |
400 Bad Request | "No se pudo actualizar el alimento" | The food item or the chef could not be found, or an unexpected error occurred. |