Merge branch 'feature/cfg-04-benachrichtigungs-einstellungen-oberflaeche' into feature/qa-09-barrierefreiheits-audit
# Conflicts: # DEVLOG.md # scripts/reset-test-env.sh # scripts/run-checks.sh
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS config_value_history;
|
||||
DROP TABLE IF EXISTS config_values;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Zentraler Konfigurationsdienst (CFG-01, siehe core-kanban/tickets/CFG-01.md).
|
||||
-- scope = 'global' fuer globale Defaults, sonst der Tenant-Slug. config_values
|
||||
-- haelt den AKTUELLEN Stand je (key, scope); config_value_history haelt JEDE
|
||||
-- Aenderung fest (Akzeptanzkriterium 2: versioniert nachvollziehbar).
|
||||
CREATE TABLE config_values (
|
||||
key TEXT NOT NULL,
|
||||
scope TEXT NOT NULL CHECK (scope <> ''),
|
||||
value TEXT NOT NULL,
|
||||
version INT NOT NULL,
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (key, scope)
|
||||
);
|
||||
|
||||
CREATE TABLE config_value_history (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
key TEXT NOT NULL,
|
||||
scope TEXT NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
version INT NOT NULL,
|
||||
changed_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX config_value_history_key_scope_idx ON config_value_history (key, scope, version);
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS notification_jobs;
|
||||
@@ -0,0 +1,20 @@
|
||||
-- Benachrichtigungs-Dispatcher-Warteschlange (CFG-02, siehe
|
||||
-- core-kanban/tickets/CFG-02.md). Postgres-basiert statt Redis/AMQP
|
||||
-- (Projekt-Konvention, siehe nexarch-state.json techstack.job_queue) —
|
||||
-- Zeilen ueberleben einen Neustart des Dispatcher-Prozesses unveraendert
|
||||
-- (Akzeptanzkriterium 3).
|
||||
CREATE TABLE notification_jobs (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
channel TEXT NOT NULL,
|
||||
recipient TEXT NOT NULL,
|
||||
payload JSONB NOT NULL DEFAULT '{}'::jsonb,
|
||||
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'sent', 'failed')),
|
||||
attempts INT NOT NULL DEFAULT 0,
|
||||
max_attempts INT NOT NULL DEFAULT 5,
|
||||
next_attempt_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
last_error TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX notification_jobs_due_idx ON notification_jobs (status, next_attempt_at);
|
||||
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS in_app_notifications;
|
||||
DROP TABLE IF EXISTS notification_templates;
|
||||
@@ -0,0 +1,28 @@
|
||||
-- Benachrichtigungs-Kanaele: Vorlagen (E-Mail) + In-App-Nachrichten
|
||||
-- (CFG-03, siehe core-kanban/tickets/CFG-03.md). Beide leben in der
|
||||
-- Registry-DB, analog zu feature_flags/config_values — modulübergreifende
|
||||
-- Konfiguration/UI-Zustand, keine Mandanten-Geschaeftsdaten.
|
||||
|
||||
-- tenant_slug = 'global' ist der Fallback-Wert, wenn ein Tenant keine
|
||||
-- eigene Vorlage gesetzt hat (Akzeptanzkriterium 3: Vorlagen pro Tenant
|
||||
-- anpassbar, mit sinnvollem Default).
|
||||
CREATE TABLE notification_templates (
|
||||
tenant_slug TEXT NOT NULL,
|
||||
key TEXT NOT NULL,
|
||||
subject TEXT NOT NULL,
|
||||
body TEXT NOT NULL,
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (tenant_slug, key)
|
||||
);
|
||||
|
||||
CREATE TABLE in_app_notifications (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_slug TEXT NOT NULL,
|
||||
user_id TEXT NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
body TEXT NOT NULL,
|
||||
read_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX in_app_notifications_user_idx ON in_app_notifications (tenant_slug, user_id, created_at);
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE notification_preferences;
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user