forum: fix API + UI column-name mismatch against bb.forum_threads
The schema has upvotes / downvotes / vote_score; API + UI were
querying/reading upvote_count / downvote_count (non-existent
columns). Threads existed in the DB but didn't render.
- /api/forum/threads route.ts:
- 'top-voted' sort: order by vote_score (was upvote_count)
- 'newest' default sort: forum_threads has no 'status' column,
so order pinned-first via is_pinned, then last_reply_at desc
- UI ForumThread interface + components: rename
upvote_count → upvotes, add downvotes + vote_score so the
vote display in the thread cards and the admin moderation
list pulls live data from the existing columns.
After this lands and the deploy completes, the 50 seeded
threads + the 9 ai-seeded new threads + 253 backfilled replies
already in the DB will all render at /forum.
This commit is contained in:
@@ -14,7 +14,7 @@ interface ForumThread {
|
||||
body: string;
|
||||
reply_count: number;
|
||||
view_count: number;
|
||||
upvote_count: number;
|
||||
upvotes: number;
|
||||
is_pinned: boolean;
|
||||
is_featured: boolean;
|
||||
is_locked: boolean;
|
||||
|
||||
Reference in New Issue
Block a user