All checks were successful
Deploy Development / deploy (push) Successful in 37s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 58s
- Added new API endpoints for content reporting, including submission, retrieval, and status updates. - Created database migration for `content_reports` table to store report data. - Integrated content reports into the existing admin inbox for better management. - Implemented validation for report submissions, including required fields and email format. - Added tests for content reporting functionality, covering various scenarios and edge cases. - Updated frontend API utility to include new content report methods. - Bumped app version to 0.8.87 and updated relevant page versions.
74 lines
2.5 KiB
SQL
74 lines
2.5 KiB
SQL
-- P-13: Content-Melde-Backend
|
|
-- Meldungen rechtswidriger Inhalte (DSA-konformes Meldeverfahren, KRIT-03)
|
|
--
|
|
-- Architektur: Diese Tabelle traegt alle fachlichen Report-Daten.
|
|
-- Die bestehende Admin-Inbox (InboxPage.jsx, GET /api/me/inbox/join-requests)
|
|
-- wird um einen zweiten Abschnitt erweitert, der Content-Reports anzeigt.
|
|
-- Keine separate Admin-Queue, keine generische inbox_items-Tabelle.
|
|
|
|
CREATE TABLE IF NOT EXISTS content_reports (
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
-- Ziel der Meldung (erweiterbar auf weitere Typen)
|
|
target_type VARCHAR(20) NOT NULL DEFAULT 'media_asset'
|
|
CHECK (target_type IN ('media_asset', 'exercise')),
|
|
target_id INTEGER NOT NULL,
|
|
|
|
-- Meldungsinhalt
|
|
report_reason VARCHAR(50) NOT NULL
|
|
CHECK (report_reason IN (
|
|
'copyright',
|
|
'image_rights',
|
|
'privacy',
|
|
'minors',
|
|
'illegal_content',
|
|
'youth_protection',
|
|
'offensive_content',
|
|
'other'
|
|
)),
|
|
report_description TEXT NOT NULL,
|
|
|
|
-- Meldende Person (Name + E-Mail Pflicht; Profil optional bei eingeloggten Nutzern)
|
|
reporter_name VARCHAR(200) NOT NULL,
|
|
reporter_email VARCHAR(200) NOT NULL,
|
|
reporter_profile_id INTEGER REFERENCES profiles(id) ON DELETE SET NULL,
|
|
|
|
-- Gutglaubenserklärung (Pflicht)
|
|
good_faith_confirmed BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
-- Automatische Priorisierung (high fuer minors/youth_protection/illegal_content)
|
|
priority VARCHAR(20) NOT NULL DEFAULT 'normal'
|
|
CHECK (priority IN ('high', 'normal')),
|
|
|
|
-- Workflow-Status
|
|
status VARCHAR(30) NOT NULL DEFAULT 'submitted'
|
|
CHECK (status IN (
|
|
'submitted',
|
|
'under_review',
|
|
'resolved_no_action',
|
|
'resolved_legal_hold',
|
|
'rejected_invalid'
|
|
)),
|
|
|
|
-- Bearbeitung
|
|
assigned_to_profile_id INTEGER REFERENCES profiles(id) ON DELETE SET NULL,
|
|
reviewed_by_profile_id INTEGER REFERENCES profiles(id) ON DELETE SET NULL,
|
|
reviewed_at TIMESTAMP,
|
|
resolution_note TEXT,
|
|
|
|
-- Zeitstempel
|
|
submitted_at TIMESTAMP DEFAULT NOW(),
|
|
created_at TIMESTAMP DEFAULT NOW(),
|
|
updated_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
-- Indices fuer Admin-Liste
|
|
CREATE INDEX IF NOT EXISTS idx_content_reports_status_created
|
|
ON content_reports (status, created_at DESC);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_content_reports_target
|
|
ON content_reports (target_type, target_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_content_reports_priority
|
|
ON content_reports (priority, status, created_at DESC);
|