feat: implement Iteration 5 — home screen dashboard
Backend: - internal/home: GET /home/summary endpoint - Today's meal plan from menu_plans/menu_items - Logged calories sum from meal_diary - Daily goal from user profile (default 2000) - Expiring products within 3 days - Last 3 saved recommendations (no AI call on home load) - Wire homeHandler in server.go and main.go Flutter: - shared/models/home_summary.dart: HomeSummary, TodaySummary, TodayMealPlan, ExpiringSoon, HomeRecipe - features/home/home_service.dart + home_provider.dart - features/home/home_screen.dart: greeting, calorie progress bar, today's meals card, expiring banner, quick actions row, recommendations horizontal list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
39
backend/internal/home/model.go
Normal file
39
backend/internal/home/model.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package home
|
||||
|
||||
// Summary is the response for GET /home/summary.
|
||||
type Summary struct {
|
||||
Today TodaySummary `json:"today"`
|
||||
ExpiringSoon []ExpiringSoon `json:"expiring_soon"`
|
||||
Recommendations []Recommendation `json:"recommendations"`
|
||||
}
|
||||
|
||||
// TodaySummary contains the day-level overview.
|
||||
type TodaySummary struct {
|
||||
Date string `json:"date"`
|
||||
DailyGoal int `json:"daily_goal"`
|
||||
LoggedCalories float64 `json:"logged_calories"`
|
||||
Plan []MealPlan `json:"plan"`
|
||||
}
|
||||
|
||||
// MealPlan is a single planned meal slot for today.
|
||||
type MealPlan struct {
|
||||
MealType string `json:"meal_type"`
|
||||
RecipeTitle *string `json:"recipe_title"`
|
||||
RecipeImageURL *string `json:"recipe_image_url"`
|
||||
Calories *float64 `json:"calories"`
|
||||
}
|
||||
|
||||
// ExpiringSoon is a product expiring within 3 days.
|
||||
type ExpiringSoon struct {
|
||||
Name string `json:"name"`
|
||||
ExpiresInDays int `json:"expires_in_days"`
|
||||
Quantity string `json:"quantity"`
|
||||
}
|
||||
|
||||
// Recommendation is a saved recipe shown on the home screen.
|
||||
type Recommendation struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
ImageURL string `json:"image_url"`
|
||||
Calories *float64 `json:"calories"`
|
||||
}
|
||||
Reference in New Issue
Block a user