Backend: - Migrations 007 (menu_plans, menu_items, shopping_lists) and 008 (meal_diary) - gemini/menu.go: GenerateMenu — 7-day × 3-meal plan via one Groq call - internal/menu: model, repository (GetByWeek, SaveMenuInTx, shopping list CRUD), handler (GET/PUT/DELETE /menu, POST /ai/generate-menu, shopping list endpoints) - internal/diary: model, repository, handler (GET/POST/DELETE /diary) - Increase server WriteTimeout to 120s for long AI calls - api_client.go: add patch() and postList() helpers Flutter: - shared/models: menu.dart, shopping_item.dart, diary_entry.dart - features/menu: menu_service.dart, menu_provider.dart (MenuNotifier, ShoppingListNotifier, DiaryNotifier with family) - MenuScreen: 7-day view, week nav, skeleton on generation, generate FAB with confirmation dialog - ShoppingListScreen: items by category, optimistic checkbox toggle - DiaryScreen: daily entries with swipe-to-delete, add-entry sheet - Router: /menu/shopping-list and /menu/diary routes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
package menu
|
|
|
|
// MenuPlan is a weekly meal plan for a user.
|
|
type MenuPlan struct {
|
|
ID string `json:"id"`
|
|
WeekStart string `json:"week_start"` // YYYY-MM-DD (Monday)
|
|
Days []MenuDay `json:"days"`
|
|
}
|
|
|
|
// MenuDay groups three meal slots for one calendar day.
|
|
type MenuDay struct {
|
|
Day int `json:"day"` // 1=Monday … 7=Sunday
|
|
Date string `json:"date"`
|
|
Meals []MealSlot `json:"meals"`
|
|
TotalCalories float64 `json:"total_calories"`
|
|
}
|
|
|
|
// MealSlot holds a single meal within a day.
|
|
type MealSlot struct {
|
|
ID string `json:"id"`
|
|
MealType string `json:"meal_type"` // breakfast | lunch | dinner
|
|
Recipe *MenuRecipe `json:"recipe,omitempty"`
|
|
}
|
|
|
|
// MenuRecipe is a thin projection of a saved recipe used in the menu view.
|
|
type MenuRecipe struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
ImageURL string `json:"image_url"`
|
|
Nutrition NutritionInfo `json:"nutrition_per_serving"`
|
|
}
|
|
|
|
// NutritionInfo holds macronutrient data.
|
|
type NutritionInfo struct {
|
|
Calories float64 `json:"calories"`
|
|
ProteinG float64 `json:"protein_g"`
|
|
FatG float64 `json:"fat_g"`
|
|
CarbsG float64 `json:"carbs_g"`
|
|
}
|
|
|
|
// PlanItem is the input needed to create one menu_items row.
|
|
type PlanItem struct {
|
|
DayOfWeek int
|
|
MealType string
|
|
RecipeID string
|
|
}
|
|
|
|
// ShoppingItem is one entry in the shopping list.
|
|
type ShoppingItem struct {
|
|
Name string `json:"name"`
|
|
Category string `json:"category"`
|
|
Amount float64 `json:"amount"`
|
|
Unit string `json:"unit"`
|
|
Checked bool `json:"checked"`
|
|
InStock float64 `json:"in_stock"`
|
|
}
|