diff --git a/lib/types.ts b/lib/types.ts index 16c33f3..3f496c9 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -12,6 +12,8 @@ export interface Profile { export interface Section { key: string; label: string; + label_en: string | null; + label_pl: string | null; time_range: string; sort: number; } @@ -19,6 +21,8 @@ export interface Section { export interface Dish { id: string; name: string; + name_en: string | null; + name_pl: string | null; price: number; allergens: string[]; additives: string[]; @@ -35,9 +39,29 @@ export interface MenuEntry { export interface CodeItem { code: string; name: string; + name_en: string | null; + name_pl: string | null; sort: number; } +export interface DishSuggestion { + id: string; + name: string; + description: string | null; + created_at: string; +} + +/** Übersetzten Namen für die aktuelle Sprache liefern, sonst Deutsch als Fallback. */ +export function localized( + item: { name?: string; label?: string; name_en?: string | null; name_pl?: string | null; label_en?: string | null; label_pl?: string | null }, + locale: string +): string { + const de = item.name ?? item.label ?? ""; + if (locale === "en") return item.name_en || item.label_en || de; + if (locale === "pl") return item.name_pl || item.label_pl || de; + return de; +} + // Farb-Defaults (r-hofmann.de: Blau #003388, Navy #0d315c, Orange #ff6900) export const DEFAULT_COLORS: Record = { primary: "#003388", @@ -61,17 +85,6 @@ export const COLOR_VARS: Record = { deleteBtn: "--c-del", }; -export const COLOR_LABELS: Record = { - primary: "Primärfarbe (Tabellenkopf)", - primaryDark: "Primärfarbe dunkel (Kopfleiste intern)", - accent: "Akzentfarbe", - headerText: "Schriftfarbe im Tabellenkopf", - rowBg: "Zellen-Hintergrund", - rowBgAlt: "Zellen-Hintergrund (alternierend)", - addBtn: "Button „Hinzufügen“", - deleteBtn: "Button „Löschen“", -}; - export function logoUrl(path: string | null | undefined): string | null { if (!path) return null; return `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/branding/${path}`; diff --git a/supabase/local/10_schema.sql b/supabase/local/10_schema.sql index 7432544..cb7d922 100644 --- a/supabase/local/10_schema.sql +++ b/supabase/local/10_schema.sql @@ -22,6 +22,9 @@ SET row_security = off; -- Name: public; Type: SCHEMA; Schema: -; Owner: - -- +-- Das "public"-Schema existiert im offiziellen postgres-Image bereits; +-- CREATE SCHEMA würde dort mit ON_ERROR_STOP=1 das komplette Init-Skript +-- abbrechen. CREATE SCHEMA IF NOT EXISTS public; @@ -106,7 +109,9 @@ SET default_table_access_method = heap; CREATE TABLE public.additives ( code text NOT NULL, name text NOT NULL, - sort integer DEFAULT 0 NOT NULL + sort integer DEFAULT 0 NOT NULL, + name_en text, + name_pl text ); @@ -117,7 +122,21 @@ CREATE TABLE public.additives ( CREATE TABLE public.allergens ( code text NOT NULL, name text NOT NULL, - sort integer DEFAULT 0 NOT NULL + sort integer DEFAULT 0 NOT NULL, + name_en text, + name_pl text +); + + +-- +-- Name: dish_suggestions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.dish_suggestions ( + id uuid DEFAULT gen_random_uuid() NOT NULL, + name text NOT NULL, + description text, + created_at timestamp with time zone DEFAULT now() NOT NULL ); @@ -132,7 +151,9 @@ CREATE TABLE public.dishes ( created_at timestamp with time zone DEFAULT now() NOT NULL, updated_at timestamp with time zone DEFAULT now() NOT NULL, allergens text[] DEFAULT '{}'::text[] NOT NULL, - additives text[] DEFAULT '{}'::text[] NOT NULL + additives text[] DEFAULT '{}'::text[] NOT NULL, + name_en text, + name_pl text ); @@ -173,7 +194,9 @@ CREATE TABLE public.sections ( key text NOT NULL, label text NOT NULL, time_range text NOT NULL, - sort integer NOT NULL + sort integer NOT NULL, + label_en text, + label_pl text ); @@ -207,6 +230,14 @@ ALTER TABLE ONLY public.allergens ADD CONSTRAINT allergens_pkey PRIMARY KEY (code); +-- +-- Name: dish_suggestions dish_suggestions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.dish_suggestions + ADD CONSTRAINT dish_suggestions_pkey PRIMARY KEY (id); + + -- -- Name: dishes dishes_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -340,6 +371,33 @@ CREATE POLICY allergens_public_read ON public.allergens FOR SELECT TO authentica CREATE POLICY allergens_staff_write ON public.allergens TO authenticated USING ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text]))) WITH CHECK ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text]))); +-- +-- Name: dish_suggestions; Type: ROW SECURITY; Schema: public; Owner: - +-- + +ALTER TABLE public.dish_suggestions ENABLE ROW LEVEL SECURITY; + +-- +-- Name: dish_suggestions dish_suggestions_public_insert; Type: POLICY; Schema: public; Owner: - +-- + +CREATE POLICY dish_suggestions_public_insert ON public.dish_suggestions FOR INSERT TO authenticated, anon WITH CHECK (true); + + +-- +-- Name: dish_suggestions dish_suggestions_staff_delete; Type: POLICY; Schema: public; Owner: - +-- + +CREATE POLICY dish_suggestions_staff_delete ON public.dish_suggestions FOR DELETE TO authenticated USING ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text]))); + + +-- +-- Name: dish_suggestions dish_suggestions_staff_select; Type: POLICY; Schema: public; Owner: - +-- + +CREATE POLICY dish_suggestions_staff_select ON public.dish_suggestions FOR SELECT TO authenticated USING ((public.app_role() = ANY (ARRAY['staff'::text, 'admin'::text]))); + + -- -- Name: dishes; Type: ROW SECURITY; Schema: public; Owner: - -- diff --git a/supabase/local/20_data.sql b/supabase/local/20_data.sql index 974e28f..5a38c99 100644 --- a/supabase/local/20_data.sql +++ b/supabase/local/20_data.sql @@ -2,7 +2,7 @@ -- PostgreSQL database dump -- -\restrict WmQEI7C1lM8AheyDeBFMpJzZHr1ZhZm5NphQHzcUeS7IAzg73qb94aso6w4qDad +\restrict m2Vnc4kNXrHeKWS4dSX5SqMU5nUOxMfipXDVyLuYabYYzEbAHutmaRS8m10Dsdh -- Dumped from database version 17.6 -- Dumped by pg_dump version 17.10 @@ -27,18 +27,18 @@ SET SESSION AUTHORIZATION DEFAULT; ALTER TABLE public.additives DISABLE TRIGGER ALL; -COPY public.additives (code, name, sort) FROM stdin; -1 mit Farbstoff 1 -2 mit Konservierungsstoff 2 -3 mit Antioxidationsmittel 3 -4 mit Geschmacksverstärker 4 -5 geschwefelt 5 -6 geschwärzt 6 -7 gewachst 7 -8 mit Phosphat 8 -9 mit Süßungsmittel(n) 9 -10 enthält eine Phenylalaninquelle 10 -11 koffeinhaltig 11 +COPY public.additives (code, name, sort, name_en, name_pl) FROM stdin; +1 mit Farbstoff 1 with colouring z barwnikiem +2 mit Konservierungsstoff 2 with preservative z konserwantem +3 mit Antioxidationsmittel 3 with antioxidant z przeciwutleniaczem +4 mit Geschmacksverstärker 4 with flavour enhancer ze wzmacniaczem smaku +5 geschwefelt 5 sulphured siarkowany +6 geschwärzt 6 blackened barwiony na czarno +7 gewachst 7 waxed woskowany +8 mit Phosphat 8 with phosphate z fosforanem +9 mit Süßungsmittel(n) 9 with sweetener(s) ze słodzikiem/słodzikami +10 enthält eine Phenylalaninquelle 10 contains a source of phenylalanine zawiera źródło fenyloalaniny +11 koffeinhaltig 11 caffeinated zawiera kofeinę \. @@ -50,50 +50,64 @@ ALTER TABLE public.additives ENABLE TRIGGER ALL; ALTER TABLE public.allergens DISABLE TRIGGER ALL; -COPY public.allergens (code, name, sort) FROM stdin; -A Glutenhaltiges Getreide 1 -B Krebstiere 2 -C Eier 3 -D Fisch 4 -E Erdnüsse 5 -F Sojabohnen 6 -G Milch (einschließlich Laktose) 7 -H Schalenfrüchte (Nüsse) 8 -I Sellerie 9 -J Senf 10 -K Sesamsamen 11 -L Schwefeldioxid und Sulfite 12 -M Lupinen 13 -N Weichtiere 14 +COPY public.allergens (code, name, sort, name_en, name_pl) FROM stdin; +A Glutenhaltiges Getreide 1 Cereals containing gluten Zboża zawierające gluten +B Krebstiere 2 Crustaceans Skorupiaki +C Eier 3 Eggs Jaja +D Fisch 4 Fish Ryby +E Erdnüsse 5 Peanuts Orzeszki ziemne +F Sojabohnen 6 Soybeans Soja +G Milch (einschließlich Laktose) 7 Milk (including lactose) Mleko (w tym laktoza) +H Schalenfrüchte (Nüsse) 8 Tree nuts Orzechy +I Sellerie 9 Celery Seler +J Senf 10 Mustard Gorczyca +K Sesamsamen 11 Sesame seeds Nasiona sezamu +L Schwefeldioxid und Sulfite 12 Sulphur dioxide and sulphites Dwutlenek siarki i siarczyny +M Lupinen 13 Lupin Łubin +N Weichtiere 14 Molluscs Mięczaki \. ALTER TABLE public.allergens ENABLE TRIGGER ALL; +-- +-- Data for Name: dish_suggestions; Type: TABLE DATA; Schema: public; Owner: - +-- + +ALTER TABLE public.dish_suggestions DISABLE TRIGGER ALL; + +COPY public.dish_suggestions (id, name, description, created_at) FROM stdin; +\. + + +ALTER TABLE public.dish_suggestions ENABLE TRIGGER ALL; + -- -- Data for Name: dishes; Type: TABLE DATA; Schema: public; Owner: - -- ALTER TABLE public.dishes DISABLE TRIGGER ALL; -COPY public.dishes (id, name, price, created_at, updated_at, allergens, additives) FROM stdin; -bf612ae7-8cdd-4149-8b21-f651631ccc02 Hackfleischbaguette 3.20 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -81c58cc6-7298-4d4a-9997-71d17df5aedf Knusperhähnchen Wrap 3.70 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -cc7fb9d9-a9ab-4c4c-a376-a8fae0e801c9 Leberkäse im Brötchen 2.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -14ef6893-93a7-4649-afe3-d6b6bdf5903c Schnitzel Baguette 3.50 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -ec3c5e37-9cbc-4c92-ab05-1e3fb942c504 Penne mit Grünen Spargel und Garnelenspieße 5.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -dbe5ee6e-8b04-4bf7-99bb-f936f6564217 Bratkartoffel Gemüse Pfanne mit Hähnchenbrust und Dip 5.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -c0613fe7-e5c6-489e-afe5-6da2533b2bd4 Schweinefilet im Speckmantel dazu Rahmsoße und Butterspätzle 5.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -c5cfa5b4-e502-4b56-b579-b9fbbf817f25 Penne mit Grünen Spargel, get. Tomaten und Cherrytomaten 5.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -f8ba1844-1f23-4b23-9e03-f59148f8b2ed Spaghetti mit fruchtiger Tomatensauce und Parmesan 5.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -7a6fed05-e0f5-4e97-bdd4-a46c5ef1376a Gebackener Feta mit griechischen Bauernsalat und Baguette 5.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -ff40ea65-63bc-4d01-b626-e0c9e5d2acb3 Gemüse-Curry mit Basmatireis 4.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -ea26f18b-ddf3-4899-95e7-5dbd0878d90c Kartoffelcremesuppe 1.50 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -6222d5f4-05e3-4af4-a41c-3f8b4c9c5c78 Gulaschsuppe 2.50 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -3c8cf0c2-b0a9-43e3-8233-723d5718a157 Tomatensuppe mit Croutons 1.80 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -2dd85835-5425-4271-9fc0-e5215bbce476 Kürbiscremesuppe 1.80 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -06df753a-65ed-4bd0-a325-d32c78ec88fa Linseneintopf mit Würstchen 2.20 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} -a987c96f-25a0-4e5e-b8a8-aab683a01feb Chili con Carne mit Brötchen 3.90 2026-07-17 15:17:02.979184+00 2026-07-17 22:21:35.276672+00 {A} {4} +COPY public.dishes (id, name, price, created_at, updated_at, allergens, additives, name_en, name_pl) FROM stdin; +bf612ae7-8cdd-4149-8b21-f651631ccc02 Hackfleischbaguette 3.20 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +81c58cc6-7298-4d4a-9997-71d17df5aedf Knusperhähnchen Wrap 3.70 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +cc7fb9d9-a9ab-4c4c-a376-a8fae0e801c9 Leberkäse im Brötchen 2.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +14ef6893-93a7-4649-afe3-d6b6bdf5903c Schnitzel Baguette 3.50 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +ec3c5e37-9cbc-4c92-ab05-1e3fb942c504 Penne mit Grünen Spargel und Garnelenspieße 5.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +dbe5ee6e-8b04-4bf7-99bb-f936f6564217 Bratkartoffel Gemüse Pfanne mit Hähnchenbrust und Dip 5.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +c0613fe7-e5c6-489e-afe5-6da2533b2bd4 Schweinefilet im Speckmantel dazu Rahmsoße und Butterspätzle 5.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +c5cfa5b4-e502-4b56-b579-b9fbbf817f25 Penne mit Grünen Spargel, get. Tomaten und Cherrytomaten 5.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +f8ba1844-1f23-4b23-9e03-f59148f8b2ed Spaghetti mit fruchtiger Tomatensauce und Parmesan 5.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +7a6fed05-e0f5-4e97-bdd4-a46c5ef1376a Gebackener Feta mit griechischen Bauernsalat und Baguette 5.30 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +ff40ea65-63bc-4d01-b626-e0c9e5d2acb3 Gemüse-Curry mit Basmatireis 4.90 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +ea26f18b-ddf3-4899-95e7-5dbd0878d90c Kartoffelcremesuppe 1.50 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +6222d5f4-05e3-4af4-a41c-3f8b4c9c5c78 Gulaschsuppe 2.50 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +3c8cf0c2-b0a9-43e3-8233-723d5718a157 Tomatensuppe mit Croutons 1.80 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +2dd85835-5425-4271-9fc0-e5215bbce476 Kürbiscremesuppe 1.80 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +06df753a-65ed-4bd0-a325-d32c78ec88fa Linseneintopf mit Würstchen 2.20 2026-07-17 15:17:02.979184+00 2026-07-17 15:17:02.979184+00 {} {} \N \N +a987c96f-25a0-4e5e-b8a8-aab683a01feb Chili con Carne mit Brötchen 3.90 2026-07-17 15:17:02.979184+00 2026-07-17 22:21:35.276672+00 {A} {4} \N \N +7ebdf56a-9482-4bde-bf60-e6e5424e397b Kürbisrisotto 0.00 2026-07-17 23:57:48.351754+00 2026-07-17 23:57:48.351754+00 {} {} \N \N +fd356340-e10f-42d7-ae5a-3521a9151bb8 Test 0.00 2026-07-17 23:58:04.141825+00 2026-07-17 23:58:19.411846+00 {} {} abc bca \. @@ -105,11 +119,11 @@ ALTER TABLE public.dishes ENABLE TRIGGER ALL; ALTER TABLE public.sections DISABLE TRIGGER ALL; -COPY public.sections (key, label, time_range, sort) FROM stdin; -brotzeit Brotzeit 09:00 - 10:00 1 -mittagessen Mittagessen 11:30 - 13:30 2 -mittagessen_veg Mittagessen vegetarisch 11:30 - 13:30 3 -suppe Suppe 11:30 - 13:30 4 +COPY public.sections (key, label, time_range, sort, label_en, label_pl) FROM stdin; +brotzeit Brotzeit 09:00 - 10:00 1 Breakfast Śniadanie +mittagessen Mittagessen 11:30 - 13:30 2 Lunch Obiad +mittagessen_veg Mittagessen vegetarisch 11:30 - 13:30 3 Lunch (vegetarian) Obiad (wegetariański) +suppe Suppe 11:30 - 13:30 4 Soup Zupa \. @@ -194,5 +208,5 @@ ALTER TABLE public.settings ENABLE TRIGGER ALL; -- PostgreSQL database dump complete -- -\unrestrict WmQEI7C1lM8AheyDeBFMpJzZHr1ZhZm5NphQHzcUeS7IAzg73qb94aso6w4qDad +\unrestrict m2Vnc4kNXrHeKWS4dSX5SqMU5nUOxMfipXDVyLuYabYYzEbAHutmaRS8m10Dsdh diff --git a/supabase/migrations/0005_i18n_and_suggestions.sql b/supabase/migrations/0005_i18n_and_suggestions.sql new file mode 100644 index 0000000..d8d1482 --- /dev/null +++ b/supabase/migrations/0005_i18n_and_suggestions.sql @@ -0,0 +1,68 @@ +-- ============================================================= +-- Mehrsprachigkeit (Inhalte) + Rezeptvorschläge +-- ============================================================= + +-- ---------- Übersetzungsspalten ---------- +-- Nullable: ohne Übersetzung fällt die Anzeige auf den deutschen +-- Text zurück. Werden manuell oder per DeepL-Anbindung befüllt. +alter table public.dishes add column name_en text, add column name_pl text; +alter table public.sections add column label_en text, add column label_pl text; +alter table public.allergens add column name_en text, add column name_pl text; +alter table public.additives add column name_en text, add column name_pl text; + +-- ---------- Referenz-Übersetzungen (feste EU-Kennzeichnung) ---------- +update public.sections set label_en = 'Breakfast', label_pl = 'Śniadanie' where key = 'brotzeit'; +update public.sections set label_en = 'Lunch', label_pl = 'Obiad' where key = 'mittagessen'; +update public.sections set label_en = 'Lunch (vegetarian)', label_pl = 'Obiad (wegetariański)' where key = 'mittagessen_veg'; +update public.sections set label_en = 'Soup', label_pl = 'Zupa' where key = 'suppe'; + +update public.allergens set name_en = 'Cereals containing gluten', name_pl = 'Zboża zawierające gluten' where code = 'A'; +update public.allergens set name_en = 'Crustaceans', name_pl = 'Skorupiaki' where code = 'B'; +update public.allergens set name_en = 'Eggs', name_pl = 'Jaja' where code = 'C'; +update public.allergens set name_en = 'Fish', name_pl = 'Ryby' where code = 'D'; +update public.allergens set name_en = 'Peanuts', name_pl = 'Orzeszki ziemne' where code = 'E'; +update public.allergens set name_en = 'Soybeans', name_pl = 'Soja' where code = 'F'; +update public.allergens set name_en = 'Milk (including lactose)', name_pl = 'Mleko (w tym laktoza)' where code = 'G'; +update public.allergens set name_en = 'Tree nuts', name_pl = 'Orzechy' where code = 'H'; +update public.allergens set name_en = 'Celery', name_pl = 'Seler' where code = 'I'; +update public.allergens set name_en = 'Mustard', name_pl = 'Gorczyca' where code = 'J'; +update public.allergens set name_en = 'Sesame seeds', name_pl = 'Nasiona sezamu' where code = 'K'; +update public.allergens set name_en = 'Sulphur dioxide and sulphites', name_pl = 'Dwutlenek siarki i siarczyny' where code = 'L'; +update public.allergens set name_en = 'Lupin', name_pl = 'Łubin' where code = 'M'; +update public.allergens set name_en = 'Molluscs', name_pl = 'Mięczaki' where code = 'N'; + +update public.additives set name_en = 'with colouring', name_pl = 'z barwnikiem' where code = '1'; +update public.additives set name_en = 'with preservative', name_pl = 'z konserwantem' where code = '2'; +update public.additives set name_en = 'with antioxidant', name_pl = 'z przeciwutleniaczem' where code = '3'; +update public.additives set name_en = 'with flavour enhancer', name_pl = 'ze wzmacniaczem smaku' where code = '4'; +update public.additives set name_en = 'sulphured', name_pl = 'siarkowany' where code = '5'; +update public.additives set name_en = 'blackened', name_pl = 'barwiony na czarno' where code = '6'; +update public.additives set name_en = 'waxed', name_pl = 'woskowany' where code = '7'; +update public.additives set name_en = 'with phosphate', name_pl = 'z fosforanem' where code = '8'; +update public.additives set name_en = 'with sweetener(s)', name_pl = 'ze słodzikiem/słodzikami' where code = '9'; +update public.additives set name_en = 'contains a source of phenylalanine', name_pl = 'zawiera źródło fenyloalaniny' where code = '10'; +update public.additives set name_en = 'caffeinated', name_pl = 'zawiera kofeinę' where code = '11'; + +-- ---------- Rezeptvorschläge ---------- +create table public.dish_suggestions ( + id uuid primary key default gen_random_uuid(), + name text not null, + description text, + created_at timestamptz not null default now() +); + +alter table public.dish_suggestions enable row level security; + +-- Jeder darf einen Vorschlag einreichen, aber niemand außer dem +-- Kantinen-Team darf die Liste einsehen (kein Lesezugriff für anon). +create policy "dish_suggestions_public_insert" on public.dish_suggestions + for insert to anon, authenticated + with check (true); + +create policy "dish_suggestions_staff_select" on public.dish_suggestions + for select to authenticated + using (public.app_role() in ('staff', 'admin')); + +create policy "dish_suggestions_staff_delete" on public.dish_suggestions + for delete to authenticated + using (public.app_role() in ('staff', 'admin'));