feat(compliance): P-01c Admin-konfigurierbare Rechtstexte (0.8.71)
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 50s

DB 047: legal_documents (versioniert, draft/published/archived) +
legal_document_audit (Änderungslog); Partial-Unique-Index garantiert
max. ein published-Dokument pro document_type.

Backend: GET /api/legal-documents/{type}/published (kein Auth);
Superadmin-CRUD + Publish/Archive + Audit unter /api/admin/legal-documents.

Frontend: LegalPage lädt aus API mit Platzhalter-Fallback;
AdminLegalDocumentsPage (/admin/legal-documents) mit Tab-Navigation,
Versionsliste, Entwurf-Editor, Publish/Archive-Workflow, Änderungslog.
AdminPageNav: Link „Rechtstexte" ergänzt.

version: 0.8.71 (backend + frontend)
module:  legal_documents 1.0.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 4.6 committed 2026-05-10 11:53:07 +02:00
1 parent 8bed0199b6
commit 80936b226d
14 files changed
+1184 -47

No files matched your search

+68 -27
View File
@@ -1,4 +1,14 @@
import { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
import api from '../utils/api'
// document_type values used in the DB / API
const TYPE_MAP = {
impressum: 'impressum',
datenschutz: 'privacy_policy',
nutzungsbedingungen: 'terms_of_use',
medienrichtlinie: 'media_policy',
}
const PAGES = {
impressum: {
@@ -143,8 +153,31 @@ const LEGAL_LINKS = [
]
function LegalPage({ type }) {
const page = PAGES[type]
if (!page) return null
const fallback = PAGES[type]
const [apiDoc, setApiDoc] = useState(undefined) // undefined = loading, null = not found
const [loading, setLoading] = useState(true)
const documentType = TYPE_MAP[type]
useEffect(() => {
if (!documentType) {
setLoading(false)
return
}
api.getPublishedLegalDocument(documentType)
.then(doc => setApiDoc(doc))
.catch(() => setApiDoc(null))
.finally(() => setLoading(false))
}, [documentType])
if (!fallback) return null
const isPlaceholder = !apiDoc
const title = apiDoc ? apiDoc.title : fallback.title
const sections = apiDoc
? (apiDoc.content_sections || [])
: fallback.sections.map(s => ({ heading: s.heading, content: s.placeholder }))
return (
<div style={{ minHeight: '100vh', background: 'var(--bg)', padding: '2rem 1rem' }}>
@@ -156,33 +189,41 @@ function LegalPage({ type }) {
</Link>
</div>
<div
className="card"
style={{
marginBottom: '1.5rem',
borderLeft: '4px solid var(--danger)',
background: 'var(--surface)',
}}
>
<strong style={{ color: 'var(--danger)' }}>⚠ MUSTER / PLATZHALTER</strong>
<p style={{ margin: '0.5rem 0 0', color: 'var(--text2)', fontSize: '0.9rem' }}>
Inhalt wird vor Produktivbetrieb juristisch geprüft und durch den Betreiber ergänzt.
Diese Seite hat keinen rechtlich verbindlichen Charakter.
</p>
</div>
{loading ? (
<div className="spinner" />
) : (
<>
{isPlaceholder && (
<div
className="card"
style={{
marginBottom: '1.5rem',
borderLeft: '4px solid var(--danger)',
background: 'var(--surface)',
}}
>
<strong style={{ color: 'var(--danger)' }}>⚠ MUSTER / PLATZHALTER</strong>
<p style={{ margin: '0.5rem 0 0', color: 'var(--text2)', fontSize: '0.9rem' }}>
Inhalt wird vor Produktivbetrieb juristisch geprüft und durch den Betreiber ergänzt.
Diese Seite hat keinen rechtlich verbindlichen Charakter.
</p>
</div>
)}
<h1 style={{ marginBottom: '2rem', color: 'var(--text1)' }}>{page.title}</h1>
<h1 style={{ marginBottom: '2rem', color: 'var(--text1)' }}>{title}</h1>
{page.sections.map((section) => (
<div key={section.heading} style={{ marginBottom: '1.75rem' }}>
<h2 style={{ fontSize: '1.05rem', marginBottom: '0.4rem', color: 'var(--text1)' }}>
{section.heading}
</h2>
<p style={{ color: 'var(--text3)', fontStyle: 'italic', margin: 0 }}>
{section.placeholder}
</p>
</div>
))}
{sections.map((section, i) => (
<div key={i} style={{ marginBottom: '1.75rem' }}>
<h2 style={{ fontSize: '1.05rem', marginBottom: '0.4rem', color: 'var(--text1)' }}>
{section.heading}
</h2>
<p style={{ color: isPlaceholder ? 'var(--text3)' : 'var(--text1)', fontStyle: isPlaceholder ? 'italic' : 'normal', margin: 0, whiteSpace: 'pre-wrap' }}>
{section.content}
</p>
</div>
))}
</>
)}
<div
style={{