Skip to main content

Endpoint

PUT /api/meal-detail/{meal_detail_id}/status
Update the consumption status of a specific meal. This is used in the Dashboard to track which meals have been eaten.

Path Parameters

meal_detail_id
integer
required
The unique identifier of the meal detail to update

Query Parameters

is_consumed
boolean
required
Whether the meal has been consumed (true) or not (false)

Authentication

This endpoint requires authentication. Include the JWT token in the Authorization header.

Response

Returns the updated meal detail with the new consumption status.
id
integer
Meal detail ID
daily_menu_id
integer
ID of the daily menu this meal belongs to
meal_type_id
integer
Type of meal (breakfast, lunch, dinner, snack)
recipe_id
integer
ID of the recipe assigned to this meal
is_consumed
boolean
Whether the meal has been consumed
recipe
object
Complete recipe information

Example Request

curl -X PUT "http://localhost:8000/api/meal-detail/123/status?is_consumed=true" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response

200 OK
{
  "id": 123,
  "daily_menu_id": 45,
  "meal_type_id": 1,
  "recipe_id": 789,
  "is_consumed": true,
  "recipe": {
    "id": 789,
    "name": "Oatmeal with Berries",
    "calories": 320.5,
    "protein_content": 12.3,
    "carbohydrate_content": 54.2,
    "fat_content": 8.1
  }
}

Error Responses

The meal detail with the specified ID does not exist.
{
  "detail": "Meal detail not found"
}
Missing or invalid authentication token.
{
  "detail": "Could not validate credentials"
}

Usage in Dashboard

This endpoint is called when users toggle the consumption status of meals in the Dashboard:
  1. User views their daily meal plan
  2. User clicks the checkbox/toggle on a meal card
  3. Frontend calls this endpoint with the meal_detail_id and new is_consumed status
  4. Dashboard updates to reflect the new nutritional totals
The Dashboard automatically recalculates daily macronutrient totals when meal status is updated.

Build docs developers (and LLMs) love