feat: add abuse prevention and moderation (Phase 5.6)
Add server-side moderation service with report submission, user banning/unbanning, and admin listing endpoints. Add client-side user blocking with message filtering in ConversationStore. Server: - ModerationService domain logic (report, ban, unban, list) - Storage trait methods + FileBackedStore + SqlStore implementations - SQL migration 012_moderation.sql (reports + bans tables) - Error codes E031-E033 for moderation - Domain types for all moderation request/response pairs - 10 new tests (6 domain + 4 storage) SDK: - blocked_users table in ConversationStore - block_user, unblock_user, is_blocked, list_blocked methods - load_recent_messages_filtered excludes blocked senders - QpqClient moderation convenience methods - 4 new tests for block/unblock/filter
This commit is contained in:
20
crates/quicproquo-server/migrations/012_moderation.sql
Normal file
20
crates/quicproquo-server/migrations/012_moderation.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Moderation tables: reports and bans.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reports (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
encrypted_report BLOB NOT NULL,
|
||||
conversation_id BLOB NOT NULL,
|
||||
reporter_identity BLOB NOT NULL,
|
||||
created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_reports_created ON reports(created_at);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bans (
|
||||
identity_key BLOB PRIMARY KEY,
|
||||
reason TEXT NOT NULL DEFAULT '',
|
||||
banned_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
||||
expires_at INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_bans_expires ON bans(expires_at);
|
||||
Reference in New Issue
Block a user