feat: Package 4 Nachbesserungen — History-Tracking, Pagination, Frontend-Fixes
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 36s
CI / test-python-backend-compliance (push) Successful in 31s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 18s
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 36s
CI / test-python-backend-compliance (push) Successful in 31s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 18s
Backend:
- Migration 009: compliance_einwilligungen_consent_history Tabelle
- EinwilligungenConsentHistoryDB Modell (consent_id, action, version, ip, ua, source)
- _record_history() Helper: automatisch bei POST /consents (granted) + PUT /revoke (revoked)
- GET /consents/{id}/history Endpoint (vor revoke platziert für korrektes Routing)
- GET /consents: history-Array pro Eintrag (inline Sub-Query)
- 5 neue Tests (TestConsentHistoryTracking) — 32/32 bestanden
Frontend:
- consent/route.ts: limit+offset aus Frontend-Request weitergeleitet, total-Feld ergänzt
- Neuer Proxy consent/[id]/history/route.ts für GET /consents/{id}/history
- page.tsx: globalStats state + loadStats() (Backend /consents/stats für globale Zahlen)
- page.tsx: Stats-Kacheln auf globalStats umgestellt (nicht mehr page-relativ)
- page.tsx: history-Mapper: created_at→timestamp, consent_version→version
- page.tsx: loadStats() bei Mount + nach Revoke
Dokumentation:
- Developer Portal: neue API-Docs-Seite /api/einwilligungen (Consent + Legal Docs + Cookie Banner)
- developer-portal/app/api/page.tsx: Consent Management Abschnitt
- MkDocs: History-Endpoint, Pagination-Abschnitt, History-Tracking Abschnitt
- Deploy-Skript: scripts/apply_consent_history_migration.sh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,59 @@ Alle vier Module sind vollstaendig backend-persistent und bieten CRUD-Operatione
|
||||
| `GET` | `/api/compliance/einwilligungen/consents` | Einwilligungen (Filter: user_id, data_point_id, granted) |
|
||||
| `POST` | `/api/compliance/einwilligungen/consents` | Neue Einwilligung erfassen |
|
||||
| `PUT` | `/api/compliance/einwilligungen/consents/{id}/revoke` | Einwilligung widerrufen |
|
||||
| `GET` | `/api/compliance/einwilligungen/consents/{id}/history` | Aenderungshistorie einer Einwilligung |
|
||||
|
||||
### Pagination
|
||||
|
||||
`GET /einwilligungen/consents` unterstuetzt Offset-basierte Pagination:
|
||||
|
||||
| Parameter | Typ | Default | Max | Beschreibung |
|
||||
|-----------|-----|---------|-----|--------------|
|
||||
| `limit` | integer | 50 | 500 | Eintraege pro Seite |
|
||||
| `offset` | integer | 0 | — | Startposition |
|
||||
|
||||
Response: `{ "total": 1234, "offset": 0, "limit": 50, "consents": [...] }`
|
||||
|
||||
### History-Tracking (Migration 009)
|
||||
|
||||
Alle Aenderungen an Einwilligungen werden automatisch in der Tabelle
|
||||
`compliance_einwilligungen_consent_history` protokolliert:
|
||||
|
||||
| Aktion | Ausgeloest bei |
|
||||
|--------|---------------|
|
||||
| `granted` | POST /consents — neue Einwilligung erteilt |
|
||||
| `revoked` | PUT /consents/{id}/revoke — Einwilligung widerrufen |
|
||||
| `version_update` | Manuell bei Versions-Upgrade (kuenftig) |
|
||||
| `renewed` | Manuell bei Erneuerung (kuenftig) |
|
||||
|
||||
**DB-Tabelle:** `compliance_einwilligungen_consent_history`
|
||||
|
||||
| Feld | Typ | Beschreibung |
|
||||
|------|-----|--------------|
|
||||
| `id` | UUID | Primaerschluessel |
|
||||
| `consent_id` | UUID | Referenz auf die Einwilligung |
|
||||
| `tenant_id` | VARCHAR(100) | Tenant-ID |
|
||||
| `action` | VARCHAR(50) | granted \| revoked \| version_update \| renewed |
|
||||
| `consent_version` | VARCHAR(20) | Version zum Zeitpunkt der Aktion |
|
||||
| `ip_address` | VARCHAR(45) | IP-Adresse (IPv4/IPv6) |
|
||||
| `user_agent` | TEXT | Browser-/Client-User-Agent |
|
||||
| `source` | VARCHAR(100) | Quelle der Aktion |
|
||||
| `created_at` | TIMESTAMP | Zeitstempel der Aktion |
|
||||
|
||||
**Datenmodell (History-Eintrag):**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "uuid",
|
||||
"consent_id": "uuid",
|
||||
"action": "granted",
|
||||
"consent_version": "v1.2",
|
||||
"ip_address": "192.168.1.1",
|
||||
"user_agent": "Mozilla/5.0...",
|
||||
"source": "web_banner",
|
||||
"created_at": "2024-01-15T10:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
**Frontend-Proxies:**
|
||||
|
||||
@@ -62,6 +115,7 @@ Alle vier Module sind vollstaendig backend-persistent und bieten CRUD-Operatione
|
||||
| `compliance_einwilligungen_company` | read/write | Unternehmens-Consent-Konfiguration |
|
||||
| `compliance_einwilligungen_cookies` | read/write | Cookie Banner Konfiguration (JSON) |
|
||||
| `compliance_einwilligungen_consents` | read/write | Erteilte und widerrufene Einwilligungen |
|
||||
| `compliance_einwilligungen_consent_history` | write | Aenderungshistorie (Migration 009) |
|
||||
|
||||
### Datenmodell (Einwilligung)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user