Backend: - Migrations 007 (menu_plans, menu_items, shopping_lists) and 008 (meal_diary) - gemini/menu.go: GenerateMenu — 7-day × 3-meal plan via one Groq call - internal/menu: model, repository (GetByWeek, SaveMenuInTx, shopping list CRUD), handler (GET/PUT/DELETE /menu, POST /ai/generate-menu, shopping list endpoints) - internal/diary: model, repository, handler (GET/POST/DELETE /diary) - Increase server WriteTimeout to 120s for long AI calls - api_client.go: add patch() and postList() helpers Flutter: - shared/models: menu.dart, shopping_item.dart, diary_entry.dart - features/menu: menu_service.dart, menu_provider.dart (MenuNotifier, ShoppingListNotifier, DiaryNotifier with family) - MenuScreen: 7-day view, week nav, skeleton on generation, generate FAB with confirmation dialog - ShoppingListScreen: items by category, optimistic checkbox toggle - DiaryScreen: daily entries with swipe-to-delete, add-entry sheet - Router: /menu/shopping-list and /menu/diary routes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
699 B
SQL
23 lines
699 B
SQL
-- +goose Up
|
|
|
|
CREATE TABLE meal_diary (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
date DATE NOT NULL,
|
|
meal_type TEXT NOT NULL,
|
|
name TEXT NOT NULL,
|
|
portions DECIMAL(5,2) NOT NULL DEFAULT 1,
|
|
calories DECIMAL(8,2),
|
|
protein_g DECIMAL(8,2),
|
|
fat_g DECIMAL(8,2),
|
|
carbs_g DECIMAL(8,2),
|
|
source TEXT NOT NULL DEFAULT 'manual',
|
|
recipe_id UUID REFERENCES saved_recipes(id) ON DELETE SET NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX idx_meal_diary_user_date ON meal_diary(user_id, date);
|
|
|
|
-- +goose Down
|
|
DROP TABLE meal_diary;
|