fix: fix menu generation errors and show planned meals on home screen

Backend fixes:
- migration 003: add 'menu' value to recipe_source enum (was causing SQLSTATE 22P02)
- migration 004: rename recipe_products→recipe_ingredients, product_id→ingredient_id (was causing SQLSTATE 42P01)
- dish/repository.go: fix INSERT INTO tags using $1/$1 for two columns → $1/$2 (was causing SQLSTATE 42P08)
- home/handler.go: replace non-existent saved_recipes table with correct joins (recipes→dishes→dish_translations, user_saved_recipes) so today's plan and recommendations load correctly
- reqlog: new slog.Handler wrapper that adds request_id and stack trace to ERROR-level logs
- all handlers: slog.Error→slog.ErrorContext so error logs include request context; writeError includes request_id in response body

Client:
- home_screen.dart: extend home screen to future dates, show planned meals as ghost entries
- l10n: add new localisation keys for home screen date navigation and planned meal UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-03-22 00:35:11 +02:00
parent 9306d59d36
commit 5096df2102
49 changed files with 824 additions and 299 deletions

View File

@@ -0,0 +1,5 @@
-- +goose Up
ALTER TYPE recipe_source ADD VALUE IF NOT EXISTS 'menu';
-- +goose Down
-- Cannot remove enum values in PostgreSQL

View File

@@ -0,0 +1,27 @@
-- +goose Up
ALTER TABLE recipe_products RENAME TO recipe_ingredients;
ALTER INDEX idx_recipe_products_recipe_id RENAME TO idx_recipe_ingredients_recipe_id;
ALTER TABLE recipe_ingredients
DROP CONSTRAINT recipe_products_product_id_fkey;
ALTER TABLE recipe_ingredients
RENAME COLUMN product_id TO ingredient_id;
ALTER TABLE recipe_ingredients
ADD CONSTRAINT recipe_ingredients_ingredient_id_fkey
FOREIGN KEY (ingredient_id) REFERENCES products(id) ON DELETE SET NULL;
ALTER TABLE recipe_product_translations RENAME TO recipe_ingredient_translations;
-- +goose Down
ALTER TABLE recipe_ingredient_translations RENAME TO recipe_product_translations;
ALTER TABLE recipe_ingredients
DROP CONSTRAINT recipe_ingredients_ingredient_id_fkey;
ALTER TABLE recipe_ingredients
RENAME COLUMN ingredient_id TO product_id;
ALTER TABLE recipe_ingredients
ADD CONSTRAINT recipe_products_product_id_fkey
FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE SET NULL;
ALTER INDEX idx_recipe_ingredients_recipe_id RENAME TO idx_recipe_products_recipe_id;
ALTER TABLE recipe_ingredients RENAME TO recipe_products;