Files
food-ai/backend/migrations/002_create_ingredient_mappings.sql
dbastrikin e57ff8e06c feat: implement Iteration 1 — AI recipe recommendations
Backend:
- Add Groq LLM client (llama-3.3-70b) for recipe generation with JSON
  retry strategy (retries only on parse errors, not API errors)
- Add Pexels client for parallel photo search per recipe
- Add saved_recipes table (migration 004) with JSONB fields
- Add GET /recommendations endpoint (profile-aware prompt building)
- Add POST/GET/GET{id}/DELETE /saved-recipes CRUD endpoints
- Wire gemini, pexels, recommendation, savedrecipe packages in main.go

Flutter:
- Add Recipe, SavedRecipe models with json_serializable
- Add RecipeService (getRecommendations, getSavedRecipes, save, delete)
- Add RecommendationsNotifier and SavedRecipesNotifier (Riverpod)
- Add RecommendationsScreen with skeleton loading and refresh FAB
- Add RecipeDetailScreen (SliverAppBar, nutrition tooltip, steps with timer)
- Add SavedRecipesScreen with Dismissible swipe-to-delete and empty state
- Update RecipesScreen to TabBar (Recommendations / Saved)
- Add /recipe-detail route outside ShellRoute (no bottom nav)
- Extend ApiClient with getList() and deleteVoid()

Project:
- Add CLAUDE.md with English-only rule for comments and commit messages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 22:43:29 +02:00

37 lines
1.0 KiB
SQL

-- +goose Up
CREATE TABLE ingredient_mappings (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
canonical_name VARCHAR(255) NOT NULL,
canonical_name_ru VARCHAR(255),
spoonacular_id INTEGER UNIQUE,
aliases JSONB NOT NULL DEFAULT '[]'::jsonb,
category VARCHAR(50),
default_unit VARCHAR(20),
-- Nutrients per 100g
calories_per_100g DECIMAL(8, 2),
protein_per_100g DECIMAL(8, 2),
fat_per_100g DECIMAL(8, 2),
carbs_per_100g DECIMAL(8, 2),
fiber_per_100g DECIMAL(8, 2),
storage_days INTEGER,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_ingredient_mappings_aliases
ON ingredient_mappings USING GIN (aliases);
CREATE INDEX idx_ingredient_mappings_canonical_name
ON ingredient_mappings (canonical_name);
CREATE INDEX idx_ingredient_mappings_category
ON ingredient_mappings (category);
-- +goose Down
DROP TABLE IF EXISTS ingredient_mappings;