base feature

This commit is contained in:
2025-10-25 15:40:28 +02:00
commit 72c50549d7
15 changed files with 2104 additions and 0 deletions

44
models/models.go Normal file
View File

@@ -0,0 +1,44 @@
package models
import "time"
// Ingredient represents a food ingredient
type Ingredient struct {
ID int `json:"id"`
Name string `json:"name"`
Unit string `json:"unit"` // e.g., "grams", "ml", "cups", "pieces", "tbsp"
}
// Meal represents a meal recipe
type Meal struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
MealType string `json:"meal_type"` // "breakfast", "lunch", "snack"
}
// MealIngredient represents an ingredient in a meal with its quantity
type MealIngredient struct {
MealID int `json:"meal_id"`
IngredientID int `json:"ingredient_id"`
Quantity float64 `json:"quantity"`
// Joined fields
IngredientName string `json:"ingredient_name,omitempty"`
Unit string `json:"unit,omitempty"`
}
// WeekPlanEntry represents a meal planned for a specific date
type WeekPlanEntry struct {
ID int `json:"id"`
Date time.Time `json:"date"`
MealID int `json:"meal_id"`
MealName string `json:"meal_name,omitempty"`
MealType string `json:"meal_type,omitempty"` // "breakfast", "lunch", "snack"
}
// GroceryItem represents an aggregated ingredient for shopping
type GroceryItem struct {
IngredientName string `json:"ingredient_name"`
TotalQuantity float64 `json:"total_quantity"`
Unit string `json:"unit"`
}