feat: 최근활동 도메인 이벤트 연결 - #104
Conversation
📝 WalkthroughWalkthrough피드백, 프로젝트, 일정 서비스가 작업 완료 후 Changes활동 로그 연결
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
🧹 Nitpick comments (2)
src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java (1)
93-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win같은
ActivityLog행에서 유형, 문구, 대상을 함께 검증하세요.현재 검증은
type과content를 별도 목록으로 확인합니다. 두 문구가 반대 유형의 로그에 저장되어도 테스트가 통과합니다.targetType과targetId도 검증하지 않습니다. 각 로그의 전체 저장 계약을 튜플로 검증하세요.수정 예시
- assertThat(activityLogs) - .extracting(ActivityLog::getType) - .containsExactlyInAnyOrder( - ActivityLogType.PROJECT_UPDATED, - ActivityLogType.PROJECT_STATUS_CHANGED - ); assertThat(activityLogs) - .extracting(ActivityLog::getContent) - .contains("그린님이 프로젝트 정보를 수정했어요", "그린님이 프로젝트 단계를 '준비중'에서 '편집중'으로 변경했어요"); + .extracting( + ActivityLog::getType, + ActivityLog::getContent, + ActivityLog::getTargetType, + ActivityLog::getTargetId + ) + .containsExactlyInAnyOrder( + tuple( + ActivityLogType.PROJECT_UPDATED, + "그린님이 프로젝트 정보를 수정했어요", + ActivityLogTargetType.PROJECT.name(), + project.getId() + ), + tuple( + ActivityLogType.PROJECT_STATUS_CHANGED, + "그린님이 프로젝트 단계를 '준비중'에서 '편집중'으로 변경했어요", + ActivityLogTargetType.PROJECT.name(), + project.getId() + ) + );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java` around lines 93 - 102, Update the assertions in ActivityLogServiceIntegrationTest so each ActivityLog’s type, content, targetType, and targetId are validated together as a single entry, rather than using separate extracted lists. Preserve the expected two log records while asserting the correct field combinations for each record.src/test/java/com/slatto/domain/feedback/service/FeedbackActivityLogConnectionTest.java (1)
91-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win저장 후 활동 로그 호출 순서를 검증하세요.
현재 테스트는
ActivityLogService호출만 검증합니다. 구현이save(...)전에 활동 로그를 생성해도 테스트가 통과합니다. 저장 실패 시 잘못된 최근활동이 남지 않도록 각 테스트에서 저장소의save(...)다음에 활동 로그 메서드가 호출되는지 검증하세요.수정 예시
+import org.mockito.InOrder; +import static org.mockito.Mockito.inOrder; + - verify(activityLogService).createVideoFeedbackCommentedLog(101L, 1L, 11L, "1차 편집본"); + InOrder inOrder = inOrder(feedbackRepository, activityLogService); + inOrder.verify(feedbackRepository).save(feedback); + inOrder.verify(activityLogService) + .createVideoFeedbackCommentedLog(101L, 1L, 11L, "1차 편집본");답글 테스트에는
feedbackDetailRepository.save(reply)를 같은 방식으로 검증하세요.Also applies to: 112-114, 132-134, 156-158
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/slatto/domain/feedback/service/FeedbackActivityLogConnectionTest.java` around lines 91 - 93, Update each relevant test in FeedbackActivityLogConnectionTest, including the cases around createFeedback and replies, to verify that the repository save operation completes before the corresponding ActivityLogService method is invoked. Use Mockito in-order verification with the specific save call (including feedbackDetailRepository.save(reply) for reply tests), then verify the existing activity-log calls in that order while retaining their current argument assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/test/java/com/slatto/domain/feedback/service/FeedbackActivityLogConnectionTest.java`:
- Around line 91-93: Update each relevant test in
FeedbackActivityLogConnectionTest, including the cases around createFeedback and
replies, to verify that the repository save operation completes before the
corresponding ActivityLogService method is invoked. Use Mockito in-order
verification with the specific save call (including
feedbackDetailRepository.save(reply) for reply tests), then verify the existing
activity-log calls in that order while retaining their current argument
assertions.
In
`@src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java`:
- Around line 93-102: Update the assertions in ActivityLogServiceIntegrationTest
so each ActivityLog’s type, content, targetType, and targetId are validated
together as a single entry, rather than using separate extracted lists. Preserve
the expected two log records while asserting the correct field combinations for
each record.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ee58a2b9-a905-4952-8872-26adf52615e3
📒 Files selected for processing (9)
src/main/java/com/slatto/domain/feedback/service/FeedbackDetailService.javasrc/main/java/com/slatto/domain/feedback/service/FeedbackService.javasrc/main/java/com/slatto/domain/project/service/ProjectFileService.javasrc/main/java/com/slatto/domain/project/service/ProjectInvitationService.javasrc/main/java/com/slatto/domain/project/service/ProjectNoticeService.javasrc/main/java/com/slatto/domain/project/service/ProjectService.javasrc/main/java/com/slatto/domain/schedule/service/ScheduleService.javasrc/test/java/com/slatto/domain/feedback/service/FeedbackActivityLogConnectionTest.javasrc/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java
🔗 관련 이슈 (Related Issue)
📝 작업 내용
프로젝트에서 발생하는 주요 변경을
ActivityLogService로 연결했습니다. 각 도메인 연결을 진행했다고 보면 될 것 같습니다!최근활동 기록 구조
flowchart LR A["프로젝트 · 공지 · 파일 · 일정 · 피드백 도메인"] B["도메인 작업 저장 성공"] C["ActivityLogService"] D["ActivityActor\n회원 · 게스트 구분"] E["ActivityMessageFactory\n화면용 문구 생성"] F[("activity_log")] G["추후 최근활동 목록 API"] A --> B --> C C --> D C --> E D --> F E --> F F --> G각 도메인은 작업이 성공한 뒤 활동 유형과 필요한 식별자만
ActivityLogService에 전달합니다. 최근 활동 문구를 조립하는 주체는 factory 게층을 따로 두어 처리하였습니다. 행위자 구분, 화면 문구 생성,activity_log저장은 공통 서비스가 담당하므로 도메인마다 저장 규칙이나 문구 조합이 달라지지 않습니다.주요 검토 파일
프로젝트 및 파일/공지 도메인
src/main/java/com/slatto/domain/project/service/ProjectService.java- 프로젝트 수정 및 진행 단계 변경 활동 기록src/main/java/com/slatto/domain/project/service/ProjectInvitationService.java- 초대 수락 후 참여자 합류 활동 기록src/main/java/com/slatto/domain/project/service/ProjectNoticeService.java- 공지 등록 활동 기록src/main/java/com/slatto/domain/project/service/ProjectFileService.java- 파일 업로드 활동 기록일정 및 피드백 도메인
src/main/java/com/slatto/domain/schedule/service/ScheduleService.java- 프로젝트 일정 생성 및 수정 활동 기록src/main/java/com/slatto/domain/feedback/service/FeedbackService.java- 회원 및 게스트 피드백 활동 기록src/main/java/com/slatto/domain/feedback/service/FeedbackDetailService.java- 회원 및 게스트 답글 활동 기록테스트
src/test/java/com/slatto/domain/feedback/service/FeedbackActivityLogConnectionTest.java- 피드백과 답글의 회원/게스트 최근활동 호출 검증src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java- 프로젝트 수정 및 상태 변경 로그의 실제 저장 검증1. 주요 도메인 이벤트 연결
알림 관련 노션 페이지
작업이 정상 저장된 후에만 최근활동을 기록하도록 연결했습니다. 각 도메인에서는 문구를 만들기 위해 필요한 인자만 보내는 형식입니다.
2. 게스트 활동 기록 지원
피드백과 답글에서 회원과 게스트를 구분해 기록합니다. 게스트의 경우
CLIENT_REVIEWER행위자로 저장되어, 외부 클라이언트의 피드백도 같은 최근활동 흐름에서 확인할 수 있습니다. 더 좋은 구조가 있을 수도 있을 것 같은데, 그러면 게스트 엔티티 자체를 수정해야할 것 같아서 일단 현재의 구조로 진행하였습니다.3. 검증
activity_log에 각각 저장되는지 확인./gradlew compileJava ./gradlew test모두 통과했습니다.
✅ PR 체크리스트
./gradlew compileJava및./gradlew test를 통과했습니다.💬 To Reviewers
활동 유형과 문구가 화면 요구사항과 맞는지 확인 부탁드립니다!
Summary by CodeRabbit
새로운 기능
테스트