Skip to content

feat: 최근활동 도메인 이벤트 연결 - #104

Merged
chazy-d merged 6 commits into
developfrom
feature/recent-activity-domain-events
Aug 4, 2026
Merged

feat: 최근활동 도메인 이벤트 연결#104
chazy-d merged 6 commits into
developfrom
feature/recent-activity-domain-events

Conversation

@chazy-d

@chazy-d chazy-d commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🔗 관련 이슈 (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
Loading

각 도메인은 작업이 성공한 뒤 활동 유형과 필요한 식별자만 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. 검증

  • 단위 테스트
    • 회원 피드백 등록 시 회원 최근활동 호출
    • 게스트 피드백 등록 시 게스트 최근활동 호출
    • 회원/게스트 답글 등록 시 각 행위자에 맞는 최근활동 호출
  • JPA 통합 테스트
    • 프로젝트 수정과 상태 변경 시 활동 유형, 문구가 activity_log에 각각 저장되는지 확인
    • 기존 파일 등록 및 게스트 피드백 저장 시나리오 회귀 확인
./gradlew compileJava
./gradlew test

모두 통과했습니다.


✅ PR 체크리스트

  • 최근활동 저장은 도메인 작업 성공 이후에만 호출됩니다.
  • 개인 일정은 프로젝트 최근활동에서 제외됩니다.
  • 회원과 게스트 피드백/답글의 행위자를 구분해 기록합니다.
  • ./gradlew compileJava./gradlew test를 통과했습니다.

💬 To Reviewers

활동 유형과 문구가 화면 요구사항과 맞는지 확인 부탁드립니다!

Summary by CodeRabbit

  • 새로운 기능

    • 피드백과 답글 작성 시 회원·게스트별 활동 로그가 기록됩니다.
    • 프로젝트 파일 업로드, 초대 수락, 공지 생성 시 활동 로그가 추가됩니다.
    • 프로젝트 수정 및 상태 변경 내역이 활동 로그에 기록됩니다.
    • 프로젝트 일정 생성·수정 활동이 기록됩니다.
  • 테스트

    • 피드백, 답글, 프로젝트 수정 및 상태 변경 활동 로그 검증을 강화했습니다.

@chazy-d chazy-d self-assigned this Aug 4, 2026
@chazy-d chazy-d added the feature 새로운 기능 추가 label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

피드백, 프로젝트, 일정 서비스가 작업 완료 후 ActivityLogService를 호출하도록 변경되었습니다. 회원·게스트 작성자와 프로젝트 일정 여부에 따른 로그 분기가 추가되었고, 관련 테스트가 보강되었습니다.

Changes

활동 로그 연결

Layer / File(s) Summary
피드백 및 답글 활동 로그
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
피드백과 답글 저장 후 회원 작성자와 게스트 작성자를 구분하여 활동 로그를 생성합니다. 관련 Mockito 테스트가 추가되었습니다.
프로젝트 작업 활동 로그
src/main/java/com/slatto/domain/project/service/ProjectFileService.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/ProjectService.java, src/main/java/com/slatto/domain/schedule/service/ScheduleService.java, src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java
프로젝트 수정 시 일반 수정 로그를 생성합니다. 상태가 변경되면 이전·새 상태 라벨을 포함한 로그를 추가합니다. 프로젝트 일정 생성·수정 시 로그를 생성하고 개인 일정에는 기록하지 않습니다. 통합 테스트가 두 프로젝트 로그와 메시지를 검증합니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • SLAT-TO/SLAT-TO-BE#101: 여러 서비스에서 새 ActivityLogService 메서드를 호출하는 직접적인 기반 변경입니다.
  • SLAT-TO/SLAT-TO-BE#60: 피드백 및 답글 서비스 흐름을 추가한 변경으로, 현재 로그 연결 대상과 직접 관련됩니다.
  • SLAT-TO/SLAT-TO-BE#103: 회원·게스트 활동 로그 API와 게스트 피드백 로그 기능을 추가한 변경입니다.

Suggested reviewers: guingguing, sangwon02, young0206

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 ActivityLogService를 통한 최근활동 도메인 이벤트 연결이라는 주요 변경 사항을 명확하게 요약합니다.
Description check ✅ Passed 작업 내용, 주요 변경 도메인, 테스트 결과와 체크리스트를 설명해 PR 설명이 대부분의 템플릿 요구사항을 충족합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java (1)

93-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

같은 ActivityLog 행에서 유형, 문구, 대상을 함께 검증하세요.

현재 검증은 typecontent를 별도 목록으로 확인합니다. 두 문구가 반대 유형의 로그에 저장되어도 테스트가 통과합니다. targetTypetargetId도 검증하지 않습니다. 각 로그의 전체 저장 계약을 튜플로 검증하세요.

수정 예시
-        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

📥 Commits

Reviewing files that changed from the base of the PR and between b92bc06 and dd61651.

📒 Files selected for processing (9)
  • src/main/java/com/slatto/domain/feedback/service/FeedbackDetailService.java
  • src/main/java/com/slatto/domain/feedback/service/FeedbackService.java
  • src/main/java/com/slatto/domain/project/service/ProjectFileService.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/ProjectService.java
  • src/main/java/com/slatto/domain/schedule/service/ScheduleService.java
  • src/test/java/com/slatto/domain/feedback/service/FeedbackActivityLogConnectionTest.java
  • src/test/java/com/slatto/domain/notification/service/ActivityLogServiceIntegrationTest.java

@guingguing guingguing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인 완료했습니다. 수고하셨습니다!

@chazy-d
chazy-d merged commit f13a661 into develop Aug 4, 2026
2 checks passed
@guingguing
guingguing deleted the feature/recent-activity-domain-events branch August 11, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants