feat: rename ingredients→products, products→user_products; add barcode/OFF import
- Rename catalog: ingredient/* → product/* (canonical_name, barcode, nutrition per 100g)
- Rename pantry: product/* → userproduct/* (user-owned items with expiry)
- Squash migrations into single 001_initial_schema.sql (clean-db baseline)
- product_categories: add English canonical name column; fix COALESCE in queries
- Remove product_translations: product names are stored in their original language
- Add default_unit_name to product API responses via unit_translations JOIN
- Add cmd/importoff: bulk import from OpenFoodFacts JSONL dump (COPY + ON CONFLICT)
- Diary: support product_id entries alongside dish_id (CHECK num_nonnulls = 1)
- Home: getLoggedCalories joins both recipes and catalog products
- Flutter: rename models/providers/services to match backend rename
- Flutter: add barcode scan flow for diary (mobile_scanner, product_portion_sheet)
- Flutter: localise 6 new keys across 12 languages (barcode scan, portion weight)
- Routes: GET /products/search, GET /products/barcode/{barcode}, /user-products
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,14 +7,15 @@ type Entry struct {
|
||||
ID string `json:"id"`
|
||||
Date string `json:"date"` // YYYY-MM-DD
|
||||
MealType string `json:"meal_type"`
|
||||
Name string `json:"name"` // from dishes JOIN
|
||||
Name string `json:"name"` // from dishes or products JOIN
|
||||
Portions float64 `json:"portions"`
|
||||
Calories *float64 `json:"calories,omitempty"` // recipe.calories_per_serving * portions
|
||||
Calories *float64 `json:"calories,omitempty"` // recipe.calories_per_serving * portions, or product * portion_g
|
||||
ProteinG *float64 `json:"protein_g,omitempty"`
|
||||
FatG *float64 `json:"fat_g,omitempty"`
|
||||
CarbsG *float64 `json:"carbs_g,omitempty"`
|
||||
Source string `json:"source"`
|
||||
DishID string `json:"dish_id"`
|
||||
DishID *string `json:"dish_id,omitempty"`
|
||||
ProductID *string `json:"product_id,omitempty"`
|
||||
RecipeID *string `json:"recipe_id,omitempty"`
|
||||
PortionG *float64 `json:"portion_g,omitempty"`
|
||||
JobID *string `json:"job_id,omitempty"`
|
||||
@@ -23,13 +24,14 @@ type Entry struct {
|
||||
|
||||
// CreateRequest is the body for POST /diary.
|
||||
type CreateRequest struct {
|
||||
Date string `json:"date"`
|
||||
MealType string `json:"meal_type"`
|
||||
Name string `json:"name"` // input-only; used if DishID is nil
|
||||
Portions float64 `json:"portions"`
|
||||
Source string `json:"source"`
|
||||
DishID *string `json:"dish_id"`
|
||||
RecipeID *string `json:"recipe_id"`
|
||||
PortionG *float64 `json:"portion_g"`
|
||||
JobID *string `json:"job_id"`
|
||||
Date string `json:"date"`
|
||||
MealType string `json:"meal_type"`
|
||||
Name string `json:"name"` // input-only; used if DishID is nil and ProductID is nil
|
||||
Portions float64 `json:"portions"`
|
||||
Source string `json:"source"`
|
||||
DishID *string `json:"dish_id"`
|
||||
ProductID *string `json:"product_id"`
|
||||
RecipeID *string `json:"recipe_id"`
|
||||
PortionG *float64 `json:"portion_g"`
|
||||
JobID *string `json:"job_id"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user