feat(profile): add public user profiles with activity tabs and stats
Add API routes for user stats, posts, reactions, and comments Implement profile view with Feeds, Contributions, Reactions tabs Link to user profiles from edit history, discussions, and life posts Add database indexes to optimize user-centric queries
This commit is contained in:
@@ -490,6 +490,10 @@ CREATE INDEX IF NOT EXISTS life_posts_active_created_at_idx
|
||||
ON life_posts(created_at DESC, id DESC)
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS life_posts_user_created_at_idx
|
||||
ON life_posts(created_by_user_id, created_at DESC, id DESC)
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS life_post_tags (
|
||||
post_id integer NOT NULL REFERENCES life_posts(id) ON DELETE CASCADE,
|
||||
tag_id integer NOT NULL REFERENCES life_tags(id) ON DELETE CASCADE,
|
||||
@@ -517,6 +521,9 @@ CREATE INDEX IF NOT EXISTS life_post_comments_post_idx
|
||||
CREATE INDEX IF NOT EXISTS life_post_comments_parent_idx
|
||||
ON life_post_comments(parent_comment_id, created_at, id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS life_post_comments_user_idx
|
||||
ON life_post_comments(created_by_user_id, created_at DESC, id DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS life_post_reactions (
|
||||
post_id integer NOT NULL REFERENCES life_posts(id) ON DELETE CASCADE,
|
||||
user_id integer NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
@@ -529,6 +536,9 @@ CREATE TABLE IF NOT EXISTS life_post_reactions (
|
||||
CREATE INDEX IF NOT EXISTS life_post_reactions_post_idx
|
||||
ON life_post_reactions(post_id, reaction_type);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS life_post_reactions_user_idx
|
||||
ON life_post_reactions(user_id, updated_at DESC, post_id DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS skills (
|
||||
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
name text NOT NULL UNIQUE,
|
||||
|
||||
Reference in New Issue
Block a user