-
Notifications
You must be signed in to change notification settings - Fork 0
[hotfix] 기록 작성시 Room과 RoomParticipant 업데이트 #170
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
Conversation
Walkthrough기록장 생성 시 퍼센트 업데이트 로직을 수정하고, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RecordCreateService
participant RoomCommandPort
participant RoomParticipantCommandPort
Client->>RecordCreateService: 기록장 생성 요청
RecordCreateService->>RoomCommandPort: Room 상태 업데이트
RecordCreateService->>RoomParticipantCommandPort: RoomParticipant 상태 업데이트
RecordCreateService-->>Client: 완료 응답
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15분 Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(해당 PR의 모든 변경 사항은 연결된 이슈의 목적에 부합합니다.) Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 0
🧹 Nitpick comments (1)
src/main/java/konkuk/thip/record/application/service/RecordCreateService.java (1)
87-87: 용어 일관성 수정 필요주석에서 여전히 "UserRoom"이라는 용어를 사용하고 있습니다. 도메인 모델과의 일관성을 위해 "RoomParticipant"로 수정해야 합니다.
- // UserRoom의 총평 작성 가능 여부 검증 + // RoomParticipant의 총평 작성 가능 여부 검증
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/konkuk/thip/record/application/service/RecordCreateService.java(3 hunks)src/main/java/konkuk/thip/room/adapter/out/jpa/RoomParticipantJpaEntity.java(2 hunks)src/main/java/konkuk/thip/room/adapter/out/persistence/RoomParticipantCommandPersistenceAdapter.java(1 hunks)src/main/java/konkuk/thip/room/application/port/out/RoomCommandPort.java(0 hunks)src/main/java/konkuk/thip/room/application/port/out/RoomParticipantCommandPort.java(1 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/konkuk/thip/room/application/port/out/RoomCommandPort.java
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서 Record와 Vote는 Room에 속하지만 Feed는 Room에 속하지 않는 구조이며, 댓글 작성 시 Record/Vote에 대해서만 사용자가 해당 Room의 참가자인지 검증이 필요하다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서는 "사용자가 방에 속하는지 검증" 로직을 RoomParticipantPolicy 도메인 서비스로 캡슐화하여 재사용성을 높이고 비즈니스 로직의 중복을 방지하는 방식을 선호한다.
📚 Learning: 2025-07-03T03:05:05.031Z
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#43
File: src/main/java/konkuk/thip/book/application/port/out/BookCommandPort.java:0-0
Timestamp: 2025-07-03T03:05:05.031Z
Learning: THIP 프로젝트에서는 CQRS Port 분리 시 다음 컨벤션을 따름: CommandPort에는 findByXXX를 통해 도메인 엔티티를 찾아오는 메서드를 추가하고, QueryPort에는 조회 API의 response에 해당하는 데이터들을 DB로부터 조회하는 메서드를 추가함.
Applied to files:
src/main/java/konkuk/thip/room/application/port/out/RoomParticipantCommandPort.javasrc/main/java/konkuk/thip/record/application/service/RecordCreateService.java
📚 Learning: 2025-07-26T06:09:00.850Z
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서는 "사용자가 방에 속하는지 검증" 로직을 RoomParticipantPolicy 도메인 서비스로 캡슐화하여 재사용성을 높이고 비즈니스 로직의 중복을 방지하는 방식을 선호한다.
Applied to files:
src/main/java/konkuk/thip/room/application/port/out/RoomParticipantCommandPort.javasrc/main/java/konkuk/thip/room/adapter/out/jpa/RoomParticipantJpaEntity.javasrc/main/java/konkuk/thip/record/application/service/RecordCreateService.java
📚 Learning: 2025-07-26T06:09:00.850Z
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서 Record와 Vote는 Room에 속하지만 Feed는 Room에 속하지 않는 구조이며, 댓글 작성 시 Record/Vote에 대해서만 사용자가 해당 Room의 참가자인지 검증이 필요하다.
Applied to files:
src/main/java/konkuk/thip/record/application/service/RecordCreateService.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 (7)
src/main/java/konkuk/thip/room/application/port/out/RoomParticipantCommandPort.java (1)
25-25: LGTM! 새로운 update 메서드 추가가 적절함
update메서드 추가가 기존 인터페이스 설계와 일관성 있게 구현되었으며, 기록 생성 시 RoomParticipant 엔티티 상태를 업데이트하는 요구사항을 잘 충족합니다.src/main/java/konkuk/thip/room/adapter/out/jpa/RoomParticipantJpaEntity.java (2)
6-6: 적절한 import 추가도메인 엔티티 import가 새로운
updateFrom메서드 구현을 위해 적절하게 추가되었습니다.
55-59: LGTM! updateFrom 메서드 구현이 우수함도메인 엔티티로부터 JPA 엔티티를 업데이트하는 메서드가 깔끔하게 구현되었습니다. 기존의 개별 필드 업데이트 메서드들과 일관성을 유지하면서도 벌크 업데이트 기능을 제공합니다. 특히
RoomParticipantRole.from()을 사용한 enum 변환이 적절합니다.src/main/java/konkuk/thip/record/application/service/RecordCreateService.java (3)
50-50: 용어 일관성 개선주석에서 "UserRoom"을 "RoomParticipant"로 수정하여 도메인 모델 용어와 일관성을 맞춘 것이 좋습니다.
66-68: LGTM! 엔티티 업데이트 로직 추가가 핵심 이슈 해결함기록 생성 후 Room과 RoomParticipant 엔티티에 대한 명시적 업데이트 호출이 추가되어, 도메인 상태 변경이 데이터베이스에 제대로 반영되도록 개선되었습니다. 이는 PR 목적에서 언급된 누락된 로직을 정확히 해결합니다.
78-81: LGTM! 퍼센트 계산 로직 개선현재 업데이트 중인 참가자를 먼저 제외하고 별도로 더하는 방식으로 계산 로직을 개선하여, 중복 계산 위험을 방지하고 정확한 퍼센트 계산을 보장합니다.
src/main/java/konkuk/thip/room/adapter/out/persistence/RoomParticipantCommandPersistenceAdapter.java (1)
63-71: LGTM! update 메서드 구현이 완벽함새로운
update메서드가 기존 어댑터 패턴과 일관성 있게 구현되었습니다:
- 적절한 예외 처리 (EntityNotFoundException with ROOM_PARTICIPANT_NOT_FOUND)
- JPA 엔티티의
updateFrom메서드 활용- 기존 메서드들과 동일한 구조와 스타일 유지
CommandPort 인터페이스를 올바르게 구현하여 도메인 엔티티 업데이트 요구사항을 충족합니다.
#️⃣ 연관된 이슈
📝 작업 내용
기록 작성시 RoomParticipant와 Room을 도메인 로직에서 업데이트하고 영속화 시키는 로직이 누락되어서 추가했습니다!
📸 스크린샷
💬 리뷰 요구사항
📌 PR 진행 시 이러한 점들을 참고해 주세요
Summary by CodeRabbit
버그 수정
신규 기능
기타