API: Add GET /api/user/comparisons for profile page #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The Profile page shows hardcoded mock data. We need an endpoint to fetch the authenticated user's comparisons.
Implementation
Create
src/app/api/user/comparisons/route.tsGET /api/user/comparisons?page=1&limit=20userId = current usercreatedAt DESCcomparisonItemsjoinCreate
src/app/api/user/stats/route.tsGET /api/user/stats{ totalComparisons, totalViews, recentComparisons[] }Response Shape
Files
src/app/api/user/comparisons/route.tssrc/app/api/user/stats/route.tssrc/app/actions/comparison.ts(getUserComparisonsat line 94-100)Acceptance Criteria