From 804cd622010fc032346f84eaf091d4767739343d Mon Sep 17 00:00:00 2001 From: sysops Date: Fri, 3 Jul 2026 23:06:14 +0200 Subject: [PATCH] =?UTF-8?q?fix(PROJ-50):=20DSGVO-Tab=20l=C3=A4dt=20nicht?= =?UTF-8?q?=20=E2=80=94=20API-Contract-Mismatch=20Frontend/Backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend liefert bei GET /api/admin/dsgvo ein Objekt {"requests":[...]}, Frontend erwartete rohes Array → .map() auf Nicht-Array warf Exception, angezeigt als "DSGVO-Anträge konnten nicht geladen werden". Zusätzlich stimmten DSGVOResultSummary/DSGVOMailResult-Feldnamen nicht mit dem Go-JSON überein (total vs. total_hits; id/status/received_at existieren im Backend nicht, stattdessen mail_id/deletable/deleted/date). Status wird jetzt im Frontend aus deletable/deleted abgeleitet (mailStatus()). Bug bestand seit Feature-Implementierung (2026-06-13), fiel erst jetzt beim ersten Live-Test auf. Co-Authored-By: Claude Sonnet 5 --- src/components/admin/tabs/DSGVOTab.tsx | 19 +++++++++++++------ src/lib/api/dsgvo.ts | 19 ++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/components/admin/tabs/DSGVOTab.tsx b/src/components/admin/tabs/DSGVOTab.tsx index 877f610..c8f2299 100644 --- a/src/components/admin/tabs/DSGVOTab.tsx +++ b/src/components/admin/tabs/DSGVOTab.tsx @@ -60,6 +60,12 @@ const MAIL_STATUS_META: Record< deleted: { label: "Gelöscht", variant: "secondary" }, }; +function mailStatus(m: DSGVOMailResult): DSGVOMailStatus { + if (m.deleted) return "deleted"; + if (m.deletable) return "deletable"; + return "rejected"; +} + function StatusBadge({ status }: { status: DSGVOStatus }) { const m = STATUS_META[status] ?? { label: status, variant: "secondary" as const }; return {m.label}; @@ -274,7 +280,7 @@ export function DSGVOTab({ canManage }: DSGVOTabProps) { - {r.result_summary?.total ?? 0} + {r.result_summary?.total_hits ?? 0}