dbastrikin
|
a225f6c47a
|
refactor: migrate ingredient aliases/categories to dedicated tables, drop spoonacular_id
- migration 012: create ingredient_categories + ingredient_category_translations
tables (7 slugs, Russian names); add ingredient_aliases (ingredient_id, lang,
alias) with GIN trigram index; migrate aliases JSONB from ingredient_mappings
and ingredient_translations; drop aliases columns and spoonacular_id; add
UNIQUE (canonical_name) as conflict key
- ingredient/model: remove SpoonacularID, add CategoryName for localized display
- ingredient/repository: conflict on canonical_name; GetByID/Search join category
translations and aliases lateral; new UpsertAliases (pgx batch),
UpsertCategoryTranslation; remove GetBySpoonacularID; split scan helpers into
scanMappingWrite / scanMappingRead
- gemini/recognition: add IngredientTranslation type; IngredientClassification
now carries Translations []IngredientTranslation instead of CanonicalNameRu;
update ClassifyIngredient prompt to English with structured translations array
- recognition/handler: update ingredientRepo interface; saveClassification uses
UpsertAliases and iterates Translations
- recipe/model: remove SpoonacularID from RecipeIngredient
- integration tests: remove SpoonacularID fixtures, replace GetBySpoonacularID
tests with GetByID, add UpsertAliases and UpsertCategoryTranslation tests
- Flutter: remove canonicalNameRu from IngredientMapping, add categoryName;
displayName returns server-resolved canonicalName; regenerate .g.dart
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-10 14:40:07 +02:00 |
|
dbastrikin
|
b9b9e9fe11
|
feat: implement Iteration 2 — product management
Backend:
- migrations/005: add pg_trgm extension + search indexes on ingredient_mappings
- migrations/006: products table with computed expires_at column
- ingredient: add Search method (aliases + ILIKE + trgm) + HTTP handler
- product: full package — model, repository (CRUD + BatchCreate + ListForPrompt), handler
- gemini: add AvailableProducts field to RecipeRequest, include in prompt
- recommendation: add ProductLister interface, load user products for personalised prompts
- server/main: wire ingredient and product handlers with new routes
Flutter:
- models: Product, IngredientMapping with json_serializable
- ProductService: getProducts, createProduct, updateProduct, deleteProduct, searchIngredients
- ProductsNotifier: create/update/delete with optimistic delete
- ProductsScreen: expiring-soon section, normal section, swipe-to-delete, edit bottom sheet
- AddProductScreen: name field with 300ms debounce autocomplete, qty/unit/days fields
- app_router: /products/add route + Badge on Products nav tab showing expiring count
- MainShell converted to ConsumerWidget for badge reactivity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-02-21 23:22:30 +02:00 |
|