feat(content-restrictions): add age rating and content rating support (#2619)

This commit is contained in:
ACX
2026-02-05 17:10:44 -07:00
committed by GitHub
parent 89b4319970
commit 9f9c762180
42 changed files with 1755 additions and 17 deletions
@@ -0,0 +1,5 @@
-- Add age rating fields to book_metadata table for content restriction filtering
ALTER TABLE book_metadata ADD COLUMN age_rating INT DEFAULT NULL;
ALTER TABLE book_metadata ADD COLUMN content_rating VARCHAR(20) DEFAULT NULL;
ALTER TABLE book_metadata ADD COLUMN age_rating_locked BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE book_metadata ADD COLUMN content_rating_locked BOOLEAN NOT NULL DEFAULT FALSE;
@@ -0,0 +1,13 @@
-- Create user_content_restriction table for per-user content filtering
CREATE TABLE user_content_restriction (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
user_id BIGINT NOT NULL,
restriction_type VARCHAR(20) NOT NULL,
mode VARCHAR(15) NOT NULL,
value VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_ucr_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
CONSTRAINT uk_user_restriction UNIQUE (user_id, restriction_type, value)
);
CREATE INDEX idx_ucr_user_id ON user_content_restriction(user_id);