Goal
Let users upvote feedback items. One vote per user/session. Toggle on/off.
Depends on: #13 (detail view) - upvoting shows on both listing cards and detail page
Backend
POST /api/feedback/[id]/vote — toggle vote
- If not voted: insert vote, return
{ voted: true, count: N }
- If already voted: remove vote, return
{ voted: false, count: N }
- Auth: authenticated user OR anonymous session required
- Unique constraint: one vote per (feedback_id, user_id OR session_id)
- Vote count is always computed (not cached) for consistency — optimize later if needed
Frontend
- Vote button on feedback cards (listing) and detail view
- Visual states: default (outline) vs voted (filled, accent color)
- Optimistic UI update on click, revert on error
- Show total vote count next to button
- User's own voted items are visually distinct in the listing
Notes
- Votes by anonymous sessions persist across visits (tied to session cookie)
- If anonymous user signs in, their votes carry over to their GitHub account
Goal
Let users upvote feedback items. One vote per user/session. Toggle on/off.
Depends on: #13 (detail view) - upvoting shows on both listing cards and detail page
Backend
POST /api/feedback/[id]/vote— toggle vote{ voted: true, count: N }{ voted: false, count: N }Frontend
Notes