- video_processor: upload extracted frames to R2, return signed URLs - feed_algorithm: cooling period (0.2x multiplier) + 60/20/20 diversity injection + record impressions - groups_handler: group feed, E2EE key-status/distribute/public-keys, invite/remove member, settings - admin_handler: groups CRUD, quip repair (FFmpeg to R2), feed scores viewer - user_handler: BulkBlockUsers POST /users/me/blocks/bulk - main.go: wire health check (/health/detailed /ready /live) + all new routes - monitoring: fix pre-existing zerolog import + uint64 type errors - migration: user_feed_impressions, group_member_keys, groups key columns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
1.1 KiB
SQL
24 lines
1.1 KiB
SQL
-- Feed cooling period: track what each user has seen
|
|
CREATE TABLE IF NOT EXISTS user_feed_impressions (
|
|
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
post_id uuid NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
|
shown_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (user_id, post_id)
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_feed_impressions_user_time ON user_feed_impressions(user_id, shown_at);
|
|
|
|
-- E2EE group key management
|
|
ALTER TABLE groups ADD COLUMN IF NOT EXISTS key_rotation_needed bool NOT NULL DEFAULT false;
|
|
ALTER TABLE groups ADD COLUMN IF NOT EXISTS key_version int NOT NULL DEFAULT 1;
|
|
|
|
CREATE TABLE IF NOT EXISTS group_member_keys (
|
|
group_id uuid NOT NULL REFERENCES groups(id) ON DELETE CASCADE,
|
|
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
key_version int NOT NULL DEFAULT 1,
|
|
encrypted_key text NOT NULL,
|
|
device_key_id text,
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (group_id, user_id, key_version)
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_group_member_keys_group ON group_member_keys(group_id, key_version);
|