[Feat] : 포인트 사용 내역 조회 + 포인트/홍보 시스템 통합 (#226)#227
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/describe |
|
/review |
|
/improve |
Review Summary by QodoAdd point usage history tracking and display feature
WalkthroughsDescription• Add point usage history tracking with new point_logs table • Implement GET /api/user/point-logs endpoint to retrieve user's point logs • Update PATCH /api/user/spend-point to record point deductions with description • Create /info/point-logs page displaying point usage history in reverse chronological order • Add point logs menu card to /info page with History icon • Integrate TanStack Query hook usePointLogsQuery for client-side data fetching Diagramflowchart LR
A["User spends point"] -->|PATCH /spend-point| B["Update user point"]
B -->|Insert log| C["point_logs table"]
D["User navigates to info"] -->|Click point-logs| E["/info/point-logs page"]
E -->|GET /point-logs| F["Fetch point logs"]
F -->|Display| G["Point usage history list"]
File Changes1. apps/web/src/app/api/user/point-logs/route.ts
|
Code Review by Qodo
Context used✅ Tickets:
🎫 포인트 사용 내역 조회 기능 추가 1. point_logs insert not enforced
|
| if (amount && description) { | ||
| await supabase.from('point_logs').insert({ user_id: userId, amount, description }); | ||
| } |
There was a problem hiding this comment.
1. point_logs insert not enforced 📎 Requirement gap ≡ Correctness
/api/user/spend-point only inserts into point_logs when amount && description are truthy and it ignores insert errors, so point 차감이 성공해도 로그가 누락될 수 있습니다. This violates the requirement to always record point spend details on success.
Agent Prompt
## Issue description
`spend-point`에서 `point_logs` 적재가 조건부(`amount && description`)로 되어 있고, insert 결과의 `error`를 확인하지 않아 로그 누락이 발생할 수 있습니다.
## Issue Context
컴플라이언스 요구사항상 포인트 차감 성공 시마다 `user_id`, `amount`, `description`이 반드시 기록되어야 합니다.
## Fix Focus Areas
- apps/web/src/app/api/user/spend-point/route.ts[10-25]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| export const usePointLogsQuery = (isAuthenticated: boolean) => { | ||
| return useQuery({ | ||
| queryKey: ['pointLogs'], | ||
| queryFn: async () => { | ||
| const response = await getUserPointLogs(); | ||
| if (!response.success) return []; | ||
| return response.data ?? []; | ||
| }, | ||
| enabled: isAuthenticated, | ||
| }); |
There was a problem hiding this comment.
3. Point logs cache leak 🐞 Bug ⛨ Security
usePointLogsQuery uses a static React Query key ['pointLogs'] and only gates fetching with isAuthenticated, so cached logs can persist across logout/login and be shown to a different user on the same device/session. This is a privacy leak of point usage history.
Agent Prompt
### Issue description
Point logs are cached under a static key and are not cleared on logout, so another user can see the previous user’s cached point logs on shared browsers/devices.
### Fix (high-level)
- Include a stable user identifier in the query key, e.g. `['pointLogs', userId]`.
- That requires `usePointLogsQuery` to accept `userId` (or read it from the user/auth store).
- Additionally (recommended), clear user-scoped queries on logout:
- In the logout flow, call `queryClient.clear()` or `queryClient.removeQueries({ queryKey: ['pointLogs'] })` (and other user-scoped keys as needed).
### Fix Focus Areas
- apps/web/src/queries/userQuery.ts[51-60]
- apps/web/src/stores/useAuthStore.ts[124-134]
- apps/web/src/app/info/point-logs/page.tsx[13-18]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Persistent review updated to latest commit aee79dc |
1 similar comment
|
Persistent review updated to latest commit aee79dc |
|
PR Description updated to latest commit (aee79dc)
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
/describe |
|
/review |
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
|
/improve |
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
1 similar comment
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
📌 PR 제목
[Feat] : 포인트 사용 내역 조회 + 포인트/홍보 시스템 통합 (#226)
📌 변경 사항
포인트 시스템
point_logs테이블 설계 및 INSERT 로직 추가GET /api/user/point-logsAPI 라우트 신규 구현/user/point엔드포인트 통합/info/point-logs) 신규 구현balance_after) 표시ThumbUpModal에서 사용처 설명 자동 전달 (노래 추천: \${title} - \${artist})홍보 시스템
/info/promotions) 레이아웃 정리PromotionBanner디자인 개선검색 UX
기타
/info메뉴 순서 및 라벨 정리💬 추가 참고 사항
point_logs테이블 수동 생성 필요 (route.ts 상단 SQL 주석 참고)