feat: Eigene und zentrale Lebensmittel bearbeiten, mit Sichtbarkeit im Mapping
Nutzer können persönliche Foods anlegen und ändern; der Admin legt zentrale Einträge für alle an. Suche und Namens-Mapping berücksichtigen persönlich, zentral und BLS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d35087ad84
commit
8b1e1da5d8
30 files changed
+1195
-120
No files matched your search
@@ -0,0 +1,18 @@
|
||||
-- Visibility invariant: personal foods have an owner; BLS and central admin foods do not.
|
||||
|
||||
UPDATE food_catalog
|
||||
SET owner_profile_id = NULL
|
||||
WHERE catalog_kind IN ('official_bls', 'manual_admin')
|
||||
AND owner_profile_id IS NOT NULL;
|
||||
|
||||
UPDATE food_catalog
|
||||
SET is_active = false
|
||||
WHERE catalog_kind = 'manual_user'
|
||||
AND owner_profile_id IS NULL;
|
||||
|
||||
ALTER TABLE food_catalog DROP CONSTRAINT IF EXISTS chk_food_catalog_owner;
|
||||
|
||||
ALTER TABLE food_catalog ADD CONSTRAINT chk_food_catalog_owner CHECK (
|
||||
(catalog_kind = 'manual_user' AND owner_profile_id IS NOT NULL)
|
||||
OR (catalog_kind IN ('official_bls', 'manual_admin') AND owner_profile_id IS NULL)
|
||||
);
|
||||
Reference in new issue
Block a user