Add adult verification and erotic moderation features: Implement new routes and controller methods for managing adult verification requests, status updates, and document retrieval. Introduce erotic moderation actions and reports, enhancing administrative capabilities. Update chat and navigation controllers to support adult content filtering and access control. Enhance user parameter handling for adult verification status and requests, improving overall user experience and compliance.

This commit is contained in:
Torsten Schulz (local)
2026-03-27 09:14:54 +01:00
parent f93687c753
commit 3e6c09ab29
73 changed files with 4459 additions and 197 deletions

View File

@@ -0,0 +1,5 @@
ALTER TABLE community.folder
ADD COLUMN IF NOT EXISTS is_adult_area BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE community.image
ADD COLUMN IF NOT EXISTS is_adult_content BOOLEAN NOT NULL DEFAULT FALSE;

View File

@@ -0,0 +1,36 @@
ALTER TABLE community.image
ADD COLUMN IF NOT EXISTS is_moderated_hidden BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE community.erotic_video
ADD COLUMN IF NOT EXISTS is_moderated_hidden BOOLEAN NOT NULL DEFAULT FALSE;
CREATE TABLE IF NOT EXISTS community.erotic_content_report (
id SERIAL PRIMARY KEY,
reporter_id INTEGER NOT NULL REFERENCES community."user"(id) ON DELETE CASCADE,
target_type VARCHAR(20) NOT NULL,
target_id INTEGER NOT NULL,
reason VARCHAR(80) NOT NULL,
note TEXT NULL,
status VARCHAR(20) NOT NULL DEFAULT 'open',
action_taken VARCHAR(40) NULL,
handled_by INTEGER NULL REFERENCES community."user"(id) ON DELETE SET NULL,
handled_at TIMESTAMP WITH TIME ZONE NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS erotic_content_report_status_idx
ON community.erotic_content_report (status, created_at DESC);
CREATE INDEX IF NOT EXISTS erotic_content_report_target_idx
ON community.erotic_content_report (target_type, target_id);
INSERT INTO type.user_param (description, datatype, settings_id, order_id, min_age)
SELECT 'adult_upload_blocked', 'bool', st.id, 999, 18
FROM type.settings st
WHERE st.name = 'account'
AND NOT EXISTS (
SELECT 1
FROM type.user_param upt
WHERE upt.description = 'adult_upload_blocked'
);

View File

@@ -0,0 +1,21 @@
-- Erotikbereich: Sichtbar ab 18, nutzbar erst nach Moderatorfreigabe
INSERT INTO type.user_param (description, datatype, settings_id, order_id, immutable, min_age, gender, unit)
SELECT 'adult_verification_status', 'string', s.id, 910, false, 18, NULL, NULL
FROM type.settings s
WHERE s.name = 'account'
AND NOT EXISTS (
SELECT 1
FROM type.user_param p
WHERE p.description = 'adult_verification_status'
);
INSERT INTO type.user_param (description, datatype, settings_id, order_id, immutable, min_age, gender, unit)
SELECT 'adult_verification_request', 'string', s.id, 911, false, 18, NULL, NULL
FROM type.settings s
WHERE s.name = 'account'
AND NOT EXISTS (
SELECT 1
FROM type.user_param p
WHERE p.description = 'adult_verification_request'
);

View File

@@ -0,0 +1,2 @@
ALTER TABLE chat.room
ADD COLUMN IF NOT EXISTS is_adult_only BOOLEAN NOT NULL DEFAULT FALSE;

View File

@@ -1,5 +1,7 @@
-- Karotte: Debug-Tempo und Preis an gleiche Basis wie andere Kat.-1-Waren (siehe initializeFalukantPredefines.js).
-- Sicher für alle Installationen: nur production_time ohne optionale Spalten.
-- Karotte: Tempo und Preis wie andere Kat.-1-Waren (sell_cost 11).
-- Invariante (siehe backend/utils/falukant/falukantProductEconomy.js): bei Zertifikat=Kategorie und
-- 100 % Wissen muss sell_cost mindestens ceil(Stückkosten * 100 / 75) sein (Kat. 1 → min. 10).
-- Nach manuell zu niedrigem sell_cost (z. B. Erlös ~3) ausführen.
BEGIN;
@@ -7,32 +9,12 @@ UPDATE falukant_type.product
SET production_time = 2
WHERE label_tr = 'carrot';
COMMIT;
-- Optional (wenn Migration mit original_sell_cost läuft): in derselben Session ausführen
/*
-- Basispreis angleichen (ohne Steuer-Aufschreibung; ggf. danach update_product_sell_costs.sql)
UPDATE falukant_type.product
SET original_sell_cost = 6
SET sell_cost = 11
WHERE label_tr = 'carrot';
WITH RECURSIVE ancestors AS (
SELECT id AS start_id, id, parent_id, tax_percent FROM falukant_data.region
UNION ALL
SELECT a.start_id, r.id, r.parent_id, r.tax_percent
FROM falukant_data.region r
JOIN ancestors a ON r.id = a.parent_id
), totals AS (
SELECT start_id, COALESCE(SUM(tax_percent), 0) AS total FROM ancestors GROUP BY start_id
), mm AS (
SELECT COALESCE(MAX(total), 0) AS max_total FROM totals
)
UPDATE falukant_type.product p
SET sell_cost = CEIL(p.original_sell_cost * (
CASE WHEN (1 - mm.max_total / 100) <= 0 THEN 1 ELSE (1 / (1 - mm.max_total / 100)) END
))
FROM mm
WHERE p.label_tr = 'carrot' AND p.original_sell_cost IS NOT NULL;
*/
COMMIT;
-- Ohne original_sell_cost: grob sell_cost = 6 (wie Milch/Brot; ggf. anpassen)
-- UPDATE falukant_type.product SET sell_cost = 6 WHERE label_tr = 'carrot';
-- Optional: Spalte original_sell_cost mitpflegen, falls ihr die MAX-STRATEGY aus update_product_sell_costs.sql nutzt
-- UPDATE falukant_type.product SET original_sell_cost = 11 WHERE label_tr = 'carrot';

View File

@@ -0,0 +1,11 @@
CREATE TABLE IF NOT EXISTS community.erotic_video (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT NULL,
original_file_name VARCHAR(255) NOT NULL,
hash VARCHAR(255) NOT NULL UNIQUE,
mime_type VARCHAR(255) NOT NULL,
user_id INTEGER NOT NULL REFERENCES community."user"(id) ON UPDATE CASCADE ON DELETE CASCADE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -4,7 +4,7 @@ UPDATE falukant_type.product
SET sell_cost = CASE label_tr
WHEN 'wheat' THEN 11
WHEN 'grain' THEN 11
WHEN 'carrot' THEN 8
WHEN 'carrot' THEN 11
WHEN 'fish' THEN 11
WHEN 'meat' THEN 11
WHEN 'leather' THEN 11