[FEAT][BUG] 사용자 시민해결사 목록 조회 및 알람 전송 시간 영역 재설정#360
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the regional alarm time window from ±12 hours to 24 hours and introduces a new endpoint (/me/solvers) to retrieve the user's active "citizen solver" participation pins using cursor-based pagination. The review feedback suggests specifying a timezone (e.g., Asia/Seoul) when calling LocalDateTime.now() to avoid environment-dependent timezone issues, using existsById instead of findById for more efficient user existence checks, and simplifying the native query's cursor condition using PostgreSQL's row-value comparison syntax.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| int pageSize = resolveSize(size); | ||
|
|
||
| userRepository.findById(uid).orElseThrow(() -> GeneralException.of(GeneralErrorCode.USER_NOT_FOUND)); | ||
|
|
There was a problem hiding this comment.
사용자의 존재 여부만 확인하는 로직에서 userRepository.findById(uid)를 사용하면 해당 User 엔티티 전체와 연관된 관계들을 영속성 컨텍스트에 로드하게 되므로 불필요한 메모리 및 쿼리 오버헤드가 발생할 수 있습니다.\n\n단순히 존재 여부만 검증할 때는 existsById(uid)를 사용하는 것이 성능상 훨씬 효율적입니다.
| if (!userRepository.existsById(uid)) { | |
| throw GeneralException.of(GeneralErrorCode.USER_NOT_FOUND); | |
| } |
| AND ( | ||
| NOT CAST(:applyCursor AS boolean) | ||
| OR ps.created_at < CAST(:cursorCreatedAt AS timestamp) | ||
| OR ( | ||
| ps.created_at = CAST(:cursorCreatedAt AS timestamp) | ||
| AND ps.problem_solver_id < :cursorProblemSolverId | ||
| ) | ||
| ) |
There was a problem hiding this comment.
PostgreSQL은 다중 열 비교(Row-value comparison)를 지원합니다. 기존의 복잡한 OR 조건문 대신 행 생성자(Row Constructor) 비교 연산자 (ps.created_at, ps.problem_solver_id) < (CAST(:cursorCreatedAt AS timestamp), :cursorProblemSolverId)를 사용하면 쿼리가 훨씬 간결해지고 가독성이 향상되며, 다중 열 인덱스(Multi-column index)를 활용한 최적화에도 유리합니다.
| AND ( | |
| NOT CAST(:applyCursor AS boolean) | |
| OR ps.created_at < CAST(:cursorCreatedAt AS timestamp) | |
| OR ( | |
| ps.created_at = CAST(:cursorCreatedAt AS timestamp) | |
| AND ps.problem_solver_id < :cursorProblemSolverId | |
| ) | |
| ) | |
| AND ( | |
| NOT CAST(:applyCursor AS boolean) | |
| OR (ps.created_at, ps.problem_solver_id) < (CAST(:cursorCreatedAt AS timestamp), :cursorProblemSolverId) | |
| ) |
🔗 Related Issue
✨ 작업 개요
사용자 시민해결사 목록 조회 API를 구현하고,
알람 전송 시간 영역을 과거 24시간으로 수정합니다.
GET /api/users/me/solvers?size={사이즈}&cursor={커서값} -> 사용자 시민해결사 목록 조회
체크리스트
📷 이미지 첨부 (선택)
🧐 집중 리뷰 요청