feat: Betrieb-Module → 100% — Echte CRUD-Flows, kein Mock-Data
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 37s
CI / test-python-backend-compliance (push) Successful in 34s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 18s

Alle 7 Betrieb-Module von 30–75% auf 100% gebracht:

**Gruppe 1 — UI-Ergänzungen (Backend bereits vorhanden):**
- incidents/page.tsx: IncidentCreateModal + IncidentDetailDrawer (Status-Transitions)
- whistleblower/page.tsx: WhistleblowerCreateModal + CaseDetailPanel (Kommentare, Zuweisung)
- dsr/page.tsx: DSRCreateModal + DSRDetailPanel (Workflow-Timeline, Status-Buttons)
- vendor-compliance/page.tsx: VendorCreateModal + "Neuer Vendor" Button

**Gruppe 2 — Escalations Full Stack:**
- Migration 011: compliance_escalations Tabelle
- Backend: escalation_routes.py (7 Endpoints: list/create/get/update/status/stats/delete)
- Proxy: /api/sdk/v1/escalations/[[...path]] → backend:8002
- Frontend: Mock-Array komplett ersetzt durch echte API + EscalationCreateModal + EscalationDetailDrawer

**Gruppe 2 — Consent Templates:**
- Migration 010: compliance_consent_email_templates + compliance_consent_gdpr_processes (7+7 Seed-Einträge)
- Backend: consent_template_routes.py (GET/POST/PUT/DELETE Templates + GET/PUT GDPR-Prozesse)
- Proxy: /api/sdk/v1/consent-templates/[[...path]]
- Frontend: consent-management/page.tsx lädt Templates + Prozesse aus DB (ApiTemplateEditor, ApiGdprProcessEditor)

**Gruppe 3 — Notfallplan:**
- Migration 012: 4 Tabellen (contacts, scenarios, checklists, exercises)
- Backend: notfallplan_routes.py (vollständiges CRUD + /stats)
- Proxy: /api/sdk/v1/notfallplan/[[...path]]
- Frontend: notfallplan/page.tsx — DB-backed Kontakte + Szenarien + Übungen, ContactCreateModal + ScenarioCreateModal

**Infrastruktur:**
- __init__.py: escalation_router + consent_template_router + notfallplan_router registriert
- Deploy-Skripte: apply_escalations_migration.sh, apply_consent_templates_migration.sh, apply_notfallplan_migration.sh
- Tests: 40 neue Tests (test_escalation_routes.py, test_consent_template_routes.py, test_notfallplan_routes.py)
- flow-data.ts: Completion aller 7 Module auf 100% gesetzt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-03 12:48:43 +01:00
parent 79b423e549
commit b19fc11737
24 changed files with 5472 additions and 529 deletions

View File

@@ -0,0 +1,48 @@
-- Migration 010: Consent Email Templates + DSGVO Processes
CREATE TABLE IF NOT EXISTS compliance_consent_email_templates (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
template_key VARCHAR(100) NOT NULL,
subject TEXT NOT NULL,
body TEXT NOT NULL,
language VARCHAR(10) DEFAULT 'de',
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
UNIQUE(tenant_id, template_key, language)
);
CREATE TABLE IF NOT EXISTS compliance_consent_gdpr_processes (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
process_key VARCHAR(100) NOT NULL,
title TEXT NOT NULL,
description TEXT,
legal_basis VARCHAR(100),
retention_days INTEGER,
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT NOW(),
UNIQUE(tenant_id, process_key)
);
-- Default email templates (seed data)
INSERT INTO compliance_consent_email_templates (tenant_id, template_key, subject, body) VALUES
('default', 'consent_confirmation', 'Ihre Einwilligung wurde bestätigt', 'Sehr geehrte/r {{name}},\n\nvielen Dank für Ihre Einwilligung vom {{date}}.\n\nMit freundlichen Grüßen'),
('default', 'consent_withdrawal', 'Widerruf Ihrer Einwilligung', 'Sehr geehrte/r {{name}},\n\nIhr Widerruf vom {{date}} wurde verarbeitet.\n\nMit freundlichen Grüßen'),
('default', 'dsr_confirmation', 'Ihre Anfrage wurde erhalten', 'Sehr geehrte/r {{name}},\n\nwir haben Ihre Anfrage vom {{date}} erhalten und werden diese innerhalb von 30 Tagen bearbeiten.\n\nMit freundlichen Grüßen'),
('default', 'dsr_completion', 'Ihre Anfrage wurde bearbeitet', 'Sehr geehrte/r {{name}},\n\nIhre Anfrage wurde erfolgreich bearbeitet.\n\nMit freundlichen Grüßen'),
('default', 'data_breach_notification', 'Wichtige Information zu Ihren Daten', 'Sehr geehrte/r {{name}},\n\nwir informieren Sie über einen Datenschutzvorfall, der Ihre Daten betreffen könnte.\n\nMit freundlichen Grüßen'),
('default', 'welcome', 'Willkommen', 'Sehr geehrte/r {{name}},\n\nwillkommen in unserem System.\n\nMit freundlichen Grüßen'),
('default', 'account_deletion', 'Ihr Konto wurde gelöscht', 'Sehr geehrte/r {{name}},\n\nIhr Konto und alle zugehörigen Daten wurden gelöscht.\n\nMit freundlichen Grüßen')
ON CONFLICT (tenant_id, template_key, language) DO NOTHING;
-- Default GDPR processes (seed data)
INSERT INTO compliance_consent_gdpr_processes (tenant_id, process_key, title, description, legal_basis, retention_days) VALUES
('default', 'access_request', 'Auskunftsrecht (Art. 15)', 'Bearbeitung von Auskunftsanfragen betroffener Personen', 'Art. 15 DSGVO', 1095),
('default', 'rectification', 'Berichtigungsrecht (Art. 16)', 'Korrektur unrichtiger personenbezogener Daten', 'Art. 16 DSGVO', 1095),
('default', 'erasure', 'Löschungsrecht (Art. 17)', 'Löschung personenbezogener Daten auf Anfrage', 'Art. 17 DSGVO', 1095),
('default', 'restriction', 'Einschränkung (Art. 18)', 'Einschränkung der Verarbeitung personenbezogener Daten', 'Art. 18 DSGVO', 1095),
('default', 'portability', 'Datenportabilität (Art. 20)', 'Übertragung von Daten in maschinenlesbarem Format', 'Art. 20 DSGVO', 1095),
('default', 'objection', 'Widerspruchsrecht (Art. 21)', 'Widerspruch gegen die Verarbeitung personenbezogener Daten', 'Art. 21 DSGVO', 1095),
('default', 'consent_management', 'Einwilligungsverwaltung (Art. 7)', 'Verwaltung von Einwilligungen und Widerrufen', 'Art. 7 DSGVO', 3650)
ON CONFLICT (tenant_id, process_key) DO NOTHING;

View File

@@ -0,0 +1,24 @@
-- Migration 011: Compliance Escalations
-- Erstellt: 2026-03-03
CREATE TABLE IF NOT EXISTS compliance_escalations (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
title TEXT NOT NULL,
description TEXT,
priority VARCHAR(20) DEFAULT 'medium',
status VARCHAR(30) DEFAULT 'open',
category VARCHAR(50),
assignee VARCHAR(200),
reporter VARCHAR(200),
source_module VARCHAR(100),
source_id UUID,
due_date TIMESTAMP,
resolved_at TIMESTAMP,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_escalations_tenant ON compliance_escalations(tenant_id);
CREATE INDEX IF NOT EXISTS idx_escalations_status ON compliance_escalations(status);
CREATE INDEX IF NOT EXISTS idx_escalations_priority ON compliance_escalations(priority);

View File

@@ -0,0 +1,53 @@
-- Migration 012: Notfallplan (Emergency Plan)
CREATE TABLE IF NOT EXISTS compliance_notfallplan_contacts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
name TEXT NOT NULL,
role VARCHAR(100),
email VARCHAR(200),
phone VARCHAR(50),
is_primary BOOLEAN DEFAULT FALSE,
available_24h BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS compliance_notfallplan_scenarios (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
title TEXT NOT NULL,
category VARCHAR(50),
severity VARCHAR(20) DEFAULT 'medium',
description TEXT,
response_steps JSONB DEFAULT '[]',
estimated_recovery_time INTEGER,
last_tested TIMESTAMP,
is_active BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS compliance_notfallplan_checklists (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
scenario_id UUID REFERENCES compliance_notfallplan_scenarios(id) ON DELETE SET NULL,
title TEXT NOT NULL,
description TEXT,
order_index INTEGER DEFAULT 0,
is_required BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS compliance_notfallplan_exercises (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(100) NOT NULL DEFAULT 'default',
title TEXT NOT NULL,
scenario_id UUID,
exercise_type VARCHAR(50) DEFAULT 'tabletop',
exercise_date TIMESTAMP,
participants JSONB DEFAULT '[]',
outcome VARCHAR(50),
notes TEXT,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_notfallplan_contacts_tenant ON compliance_notfallplan_contacts(tenant_id);
CREATE INDEX IF NOT EXISTS idx_notfallplan_scenarios_tenant ON compliance_notfallplan_scenarios(tenant_id);