-
Notifications
You must be signed in to change notification settings - Fork 4
[Feat] 알림 전부 읽기 #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] 알림 전부 읽기 #373
Conversation
Walkthrough사용자의 모든 알림과 공지사항을 일괄로 읽음(isChecked=true) 처리하는 엔드포인트와 서비스/저장소 쿼리, 테스트 및 서브모듈 해시 업데이트가 추가되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as 클라이언트
participant Controller as AlarmController
participant Service as AlarmService
participant UserSvc as UserService
participant AlarmRepo as AlarmRepository
participant AnnouncementRepo as UserAnnouncementRepository
participant DB as 데이터베이스
Client->>Controller: PATCH /api/v1/alarm/read-all\n(Authorization)
Controller->>Service: patchAllUserAlarm(userDetails)
Service->>UserSvc: getUser()
UserSvc-->>Service: User
rect rgb(220,240,255)
Note over Service,AlarmRepo: 알림 일괄 읽음
Service->>AlarmRepo: markCheckedByUser(user)
AlarmRepo->>DB: UPDATE Alarm SET isChecked = true WHERE user = ?
DB-->>AlarmRepo: 업데이트 결과
Note over Service,AnnouncementRepo: 공지 일괄 읽음
Service->>AnnouncementRepo: markCheckedByUser(user)
AnnouncementRepo->>DB: UPDATE UserAnnouncement SET isChecked = true WHERE user = ?
DB-->>AnnouncementRepo: 업데이트 결과
end
Service-->>Controller: (void)
Controller-->>Client: 200 OK (BaseResponse<Void>)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20분 Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/java/ku_rum/backend/domain/alarm/application/AlarmService.java (1)
170-175: 트랜잭션 처리가 올바르게 구현되었습니다.
@Transactional어노테이션이 적용되어 있어 두 저장소 업데이트가 원자적으로 처리됩니다. 로직이 명확하고 구현이 정확합니다.📊 관찰성 개선을 위한 선택적 제안
저장소 메서드가 반환하는 업데이트된 행 수를 로깅하면 운영 중 모니터링에 도움이 될 수 있습니다.
@Transactional public void patchAllUserAlarm(CustomUserDetails userDetails) { User user = userService.getUser(); - userAnnouncementRepository.markCheckedByUser(user); - alarmRepository.markCheckedByUser(user); + int announcementCount = userAnnouncementRepository.markCheckedByUser(user); + int alarmCount = alarmRepository.markCheckedByUser(user); + log.info("Marked {} announcements and {} alarms as checked for user {}", + announcementCount, alarmCount, user.getId()); }src/test/java/ku_rum/backend/domain/alarm/presentation/AlarmControllerTest.java (1)
282-309: 테스트 커버리지가 적절하게 추가되었습니다.새로운 엔드포인트에 대한 테스트가 올바르게 작성되었으며, REST Docs 문서화도 포함되어 있습니다. 컨트롤러 계층 테스트로서 충분합니다.
🧪 선택적 개선 사항
서비스 메서드 호출 여부를 명시적으로 검증하면 테스트가 더 견고해집니다.
mockMvc.perform(patch("/api/v1/alarm/read-all") .header("Authorization", "Bearer test-access-token")) // then .andDo(print()) - .andExpect(status().isOk()) + .andExpect(status().isOk()); + +verify(alarmService, times(1)).patchAllUserAlarm(any());
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/main/java/ku_rum/backend/domain/alarm/application/AlarmService.javasrc/main/java/ku_rum/backend/domain/alarm/domain/repository/AlarmRepository.javasrc/main/java/ku_rum/backend/domain/alarm/domain/repository/UserAnnouncementRepository.javasrc/main/java/ku_rum/backend/domain/alarm/presentation/AlarmController.javasrc/main/resources/configsrc/test/java/ku_rum/backend/domain/alarm/presentation/AlarmControllerTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (3)
src/main/resources/config (1)
1-1: 구현 파일이 제공되지 않았습니다.서브모듈 참조 업데이트만 제공되었으며, PR 요약에 언급된 실제 기능 구현 파일들(AlarmService, AlarmRepository, UserAnnouncementRepository, AlarmController, AlarmControllerTest)이 검토 대상에 포함되지 않았습니다.
완전한 코드 리뷰를 위해 다음 파일들의 검토를 요청합니다:
src/main/java/ku_rum/backend/domain/alarm/application/AlarmService.javasrc/main/java/ku_rum/backend/domain/alarm/domain/repository/AlarmRepository.javasrc/main/java/ku_rum/backend/domain/alarm/domain/repository/UserAnnouncementRepository.javasrc/main/java/ku_rum/backend/domain/alarm/presentation/AlarmController.javasrc/test/java/ku_rum/backend/domain/alarm/presentation/AlarmControllerTest.javasrc/main/java/ku_rum/backend/domain/alarm/presentation/AlarmController.java (1)
54-58: 새로운 엔드포인트 구현이 적절합니다.
/read-all엔드포인트가 올바르게 구현되었습니다. 인증 처리와 서비스 위임이 적절하며, HTTP PATCH 메서드 사용도 RESTful 관례에 부합합니다.src/main/java/ku_rum/backend/domain/alarm/domain/repository/UserAnnouncementRepository.java (1)
29-31: 업데이트 쿼리가 올바르게 구현되었습니다.
@Modifying어노테이션과 함께 사용된 벌크 업데이트 쿼리가 정확하며, 별칭 명명도 적절합니다. 사용자별 공지사항을 효율적으로 일괄 업데이트합니다.
src/main/java/ku_rum/backend/domain/alarm/domain/repository/AlarmRepository.java
Show resolved
Hide resolved
Test Results 38 files 38 suites 11s ⏱️ Results for commit df9d205. ♻️ This comment has been updated with latest results. |
kmw10693
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿 고생하셨습니다
#️⃣ 연관된 이슈
closes #372
📝작업 내용
작업 상세 내용
상세 내용을 입력해주세요.
💬리뷰 요구사항
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.