[home/profile] 홈 안읽은 알림 플래그 + 프로필 레벨 응답 추가#265
Conversation
- 홈 V2 응답에 hasUnreadNotification(boolean) 추가 — 알림 전체 목록 호출 대신 exists 쿼리로 새 알림 유무만 경량 반환 - 프로필 V2 응답에 currentLevel 추가 (UserLevelFinder 경량 조회, 기본 1) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 805209ab71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fun existsByUserIdAndIsReadFalseAndCreatedAtAfter( | ||
| userId: UUID, | ||
| createdAt: LocalDateTime, | ||
| ): Boolean |
There was a problem hiding this comment.
Add an index for the unread lookup
Checked src/main/resources/db/migration/V2__create_notification_tables.sql lines 1-10: notification_histories only has the primary key, so this new existsByUserIdAndIsReadFalseAndCreatedAtAfter predicate cannot use an index on user/read/time. Because it is now executed from GET /api/v2/home on every home load, users with no unread notifications, or mostly read/old rows, can force full table scans as histories accumulate; add a composite index such as (user_id, is_read, created_at) with the new query.
Useful? React with 👍 / 👎.
GET /api/v2/home 마다 실행되는 existsByUserIdAndIsReadFalseAndCreatedAtAfter가 notification_histories(user_id, is_read, created_at) 인덱스를 타도록 V41 추가 (코드리뷰 반영, 풀스캔 방지) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
작업 내용
홈 화면 알림 호출 효율화
GET /api/v1/notification-histories로 전체 목록을 받아야 했음(비효율)GET /api/v2/home응답에hasUnreadNotification: Boolean추가existsByUserIdAndIsReadFalseAndCreatedAtAfter경량 exists 쿼리로 새 알림 유무만 판단(보존기간 30일 내)프로필 레벨 노출
GET /api/v2/users/profile응답에currentLevel: Int추가UserLevelFinder(경량 조회, UserLevel 없으면 기본 1) 신설🤖 Generated with Claude Code