Files
food-ai/backend/internal/domain/recipe/entity.go
dbastrikin 6594013b53 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>
2026-03-15 22:12:07 +02:00

50 lines
1.6 KiB
Go

package recipe
import "time"
// Recipe is a cooking variant of a Dish in the catalog.
// It links to a Dish for all presentational data (name, image, cuisine, tags).
type Recipe struct {
ID string `json:"id"`
DishID string `json:"dish_id"`
Source string `json:"source"` // ai | user | spoonacular
Difficulty *string `json:"difficulty"`
PrepTimeMin *int `json:"prep_time_min"`
CookTimeMin *int `json:"cook_time_min"`
Servings *int `json:"servings"`
CaloriesPerServing *float64 `json:"calories_per_serving"`
ProteinPerServing *float64 `json:"protein_per_serving"`
FatPerServing *float64 `json:"fat_per_serving"`
CarbsPerServing *float64 `json:"carbs_per_serving"`
FiberPerServing *float64 `json:"fiber_per_serving"`
Ingredients []RecipeIngredient `json:"ingredients"`
Steps []RecipeStep `json:"steps"`
Notes *string `json:"notes,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// RecipeIngredient is a single ingredient row from recipe_ingredients.
type RecipeIngredient struct {
ID string `json:"id"`
IngredientID *string `json:"ingredient_id"`
Name string `json:"name"`
Amount float64 `json:"amount"`
UnitCode *string `json:"unit_code"`
IsOptional bool `json:"is_optional"`
SortOrder int `json:"sort_order"`
}
// RecipeStep is a single step row from recipe_steps.
type RecipeStep struct {
ID string `json:"id"`
StepNumber int `json:"step_number"`
Description string `json:"description"`
TimerSeconds *int `json:"timer_seconds"`
ImageURL *string `json:"image_url"`
}