refactor: introduce internal/domain/ layer, rename model.go → entity.go
Move all business-logic packages from internal/ root into internal/domain/: auth, cuisine, diary, dish, home, ingredient, language, menu, product, recipe, recognition, recommendation, savedrecipe, tag, units, user Rename model.go → entity.go in packages that hold domain entities: diary, dish, home, ingredient, menu, product, recipe, savedrecipe, user Update all import paths accordingly (adapters, infra/server, cmd/server, tests). No logic changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
56
backend/internal/domain/menu/entity.go
Normal file
56
backend/internal/domain/menu/entity.go
Normal file
@@ -0,0 +1,56 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user