Skip to content

Conversation

@buzz0331
Copy link
Contributor

@buzz0331 buzz0331 commented Aug 7, 2025

#️⃣ 연관된 이슈

closes #169

📝 작업 내용

기록 작성시 RoomParticipant와 Room을 도메인 로직에서 업데이트하고 영속화 시키는 로직이 누락되어서 추가했습니다!

📸 스크린샷

💬 리뷰 요구사항

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

📌 PR 진행 시 이러한 점들을 참고해 주세요

* P1 : 꼭 반영해 주세요 (Request Changes) - 이슈가 발생하거나 취약점이 발견되는 케이스 등
* P2 : 반영을 적극적으로 고려해 주시면 좋을 것 같아요 (Comment)
* P3 : 이런 방법도 있을 것 같아요~ 등의 사소한 의견입니다 (Chore)

Summary by CodeRabbit

  • 버그 수정

    • 진행률 계산 시 중복 집계 문제를 해결하여 올바른 참여자 진행률이 반영되도록 수정했습니다.
  • 신규 기능

    • 방 참여자의 상태를 업데이트하는 기능이 추가되었습니다.
  • 기타

    • 일부 용어를 더 정확하게 반영하도록 수정했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 7, 2025

Walkthrough

기록장 생성 시 퍼센트 업데이트 로직을 수정하고, RoomParticipant 엔티티의 상태를 갱신하는 새로운 메서드와 포트/어댑터 계층에 관련 메서드를 추가하였습니다. 또한, 도메인 용어를 일관되게 변경하고, 불필요한 import를 제거하는 등 유지보수성을 개선하는 변경이 이루어졌습니다.

Changes

Cohort / File(s) Change Summary
Record 생성 및 퍼센트 업데이트 로직 개선
src/main/java/konkuk/thip/record/application/service/RecordCreateService.java
UserRoomRoomParticipant로 주석 수정, 기록 저장 후 Room과 RoomParticipant의 상태를 명시적으로 업데이트, 퍼센트 계산 시 중복 합산 방지 로직 적용
RoomParticipant 갱신 메서드 추가
src/main/java/konkuk/thip/room/adapter/out/jpa/RoomParticipantJpaEntity.java
updateFrom(RoomParticipant) 메서드 추가: 도메인 객체의 값을 JPA 엔티티에 반영
RoomParticipant 업데이트 어댑터 추가
src/main/java/konkuk/thip/room/adapter/out/persistence/RoomParticipantCommandPersistenceAdapter.java
update(RoomParticipant) 메서드 추가: ID로 JPA 엔티티 조회 후 상태 갱신 및 저장
불필요한 import 제거
src/main/java/konkuk/thip/room/application/port/out/RoomCommandPort.java
Category import 삭제, 그 외 변화 없음
RoomParticipantCommandPort에 업데이트 메서드 추가
src/main/java/konkuk/thip/room/application/port/out/RoomParticipantCommandPort.java
void update(RoomParticipant) 메서드 선언 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RecordCreateService
    participant RoomCommandPort
    participant RoomParticipantCommandPort

    Client->>RecordCreateService: 기록장 생성 요청
    RecordCreateService->>RoomCommandPort: Room 상태 업데이트
    RecordCreateService->>RoomParticipantCommandPort: RoomParticipant 상태 업데이트
    RecordCreateService-->>Client: 완료 응답
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15분

Assessment against linked issues

Objective Addressed Explanation
기록장 생성 시 퍼센트 업데이트 로직 수정 (#169)
RoomParticipant 상태 업데이트 기능 추가 (#169)
도메인 용어 일관성 유지 (#169)

Assessment against linked issues: Out-of-scope changes

(해당 PR의 모든 변경 사항은 연결된 이슈의 목적에 부합합니다.)

Possibly related PRs

  • [refactor] 패키지 구조 정리 #81: UserRoomRoomParticipant로의 도메인 엔티티 명칭 변경 및 패키지 구조 개편과 관련된 PR로, 본 PR의 도메인 일관성 개선과 직접적으로 연관됨.

Suggested reviewers

  • seongjunnoh

Poem

🐇
기록장에 봄바람, 퍼센트도 싱그럽게
참가자 상태 갱신, 코드가 춤을 추네
도메인 이름도 반듯하게,
리뷰어의 미소도 활짝 피어나길
토끼가 박수 짝짝,
오늘도 코드에 사랑을 담아!
📝✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/#169-update-user-progress

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@buzz0331 buzz0331 merged commit ded26f5 into develop Aug 7, 2025
1 of 2 checks passed
@buzz0331 buzz0331 deleted the hotfix/#169-update-user-progress branch August 7, 2025 17:03
Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3145462 and 83d6913.

📒 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.java
  • src/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.java
  • src/main/java/konkuk/thip/room/adapter/out/jpa/RoomParticipantJpaEntity.java
  • src/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 인터페이스를 올바르게 구현하여 도메인 엔티티 업데이트 요구사항을 충족합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[THIP2025-224] [hotfix] 기록장 생성시 퍼센트 업데이트

2 participants