Add contact relay and DMCA workflow

This commit is contained in:
JB
2026-07-25 19:20:43 -04:00
parent e0bf3b05ab
commit 7f9a75021d
11 changed files with 308 additions and 4 deletions
+18
View File
@@ -40,6 +40,24 @@ CREATE TABLE IF NOT EXISTS notifications (
);
CREATE INDEX IF NOT EXISTS notifications_user_created_idx ON notifications(user_id, created_at DESC);
CREATE INDEX IF NOT EXISTS notifications_user_unread_idx ON notifications(user_id, read_at, created_at DESC);
CREATE TABLE IF NOT EXISTS contact_messages (
id TEXT PRIMARY KEY,
sender_user_id TEXT REFERENCES users(id) ON DELETE SET NULL,
sender_name TEXT NOT NULL,
sender_email TEXT NOT NULL,
team TEXT NOT NULL CHECK(team IN ('oversight', 'administrators', 'dmca')),
subject TEXT NOT NULL,
body TEXT NOT NULL,
dmca_json TEXT,
created_at TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS contact_message_recipients (
message_id TEXT NOT NULL REFERENCES contact_messages(id) ON DELETE CASCADE,
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
PRIMARY KEY(message_id, user_id)
);
CREATE INDEX IF NOT EXISTS contact_messages_created_idx ON contact_messages(created_at DESC);
CREATE INDEX IF NOT EXISTS contact_message_recipients_user_idx ON contact_message_recipients(user_id, message_id);
CREATE TABLE IF NOT EXISTS notification_preferences (
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
category TEXT NOT NULL CHECK(category IN ('isac', 'contributions', 'comments', 'builds', 'guides', 'system')),