CFG-04: backend teil 1 — internal/notifyprefs (praeferenz-store + enqueueifallowed-filter vor dispatcher)

This commit is contained in:
sysops
2026-08-28 23:47:46 +02:00
parent 034865f5a0
commit 2df3f93373
3 changed files with 162 additions and 0 deletions
@@ -0,0 +1,17 @@
-- CFG-04: Benachrichtigungspraeferenzen je Benutzer, Ereignistyp und Kanal.
-- Lebt wie notification_templates/in_app_notifications (CFG-03) in der
-- Registry-DB — modulübergreifende Konfiguration, keine Mandanten-Geschaeftsdaten.
--
-- Kein Row = aktiviert (Opt-out-Modell): ein Benutzer verpasst nichts, bis er
-- aktiv einen Kanal/Ereignistyp abschaltet — sicherer Default als Opt-in.
CREATE TABLE notification_preferences (
tenant_slug TEXT NOT NULL,
user_id TEXT NOT NULL,
event_type TEXT NOT NULL,
channel TEXT NOT NULL,
enabled BOOLEAN NOT NULL,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (tenant_slug, user_id, event_type, channel)
);
CREATE INDEX notification_preferences_tenant_idx ON notification_preferences (tenant_slug);