Conversation
- 채팅방 목록 조회 시 썸네일 필드 추가 - 채팅방 상세 조회 시 방장을 나타내는 필드 추가 - 채팅방 목록 조회 시 최근 메시지 순 정렬 적용
Walkthrough채팅 응답 DTO들에 썸네일 필드와 참여자 소유자 플래그를 추가하고, ChatRoomService에 그룹/DM 썸네일 해석 및 호스트 기반 소유권 판별 로직을 도입했습니다. 이벤트 리스너에 그룹 가입 승인/강제 퇴장 처리 핸들러가 추가되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client as 클라이언트
participant Service as ChatRoomService
participant ChatRoom as ChatRoom (도메인)
participant Repo as GroupImageV2Repository
participant UserDB as User/Profile DB
Client->>Service: 채팅방 목록/상세 요청
Service->>ChatRoom: 채팅방 및 참가자 정보 조회
alt 그룹 채팅 (group != null)
Service->>Repo: 그룹 이미지(variant 목록) 조회
Repo-->>Service: 이미지 목록 (variant 포함)
Service->>Service: 첫 이미지의 THUMBNAIL_100_100 URL 선택
else DM
Service->>UserDB: 상대 참가자 프로필 조회
UserDB-->>Service: 프로필 이미지 URL
end
Service->>Service: 참가자별 isOwner 판별 (hostId 기반)
Service-->>Client: ChatRoomResponse / ChatRoomItemResponse (thumbnail, isOwner 포함)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
시
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🔇 Additional comments (2)
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/team/wego/wegobackend/chat/domain/entity/ChatRoom.java (1)
98-103:getHostId에도 동일한 null 체크 필요
isHost메서드와 동일하게,group.getHost()가 null일 가능성을 고려해야 합니다.🔎 방어적 null 체크를 추가한 개선안
public Long getHostId() { if (!isGroupChat() || group == null) { return null; } + if (group.getHost() == null) { + return null; + } return group.getHost().getId(); }
isHost메서드에도 동일한 방어 로직 추가:public boolean isHost(User user) { if (!isGroupChat() || group == null) { return false; } + if (group.getHost() == null) { + return false; + } return group.getHost().getId().equals(user.getId()); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/team/wego/wegobackend/chat/application/dto/response/ChatRoomItemResponse.javasrc/main/java/team/wego/wegobackend/chat/application/dto/response/ChatRoomResponse.javasrc/main/java/team/wego/wegobackend/chat/application/dto/response/ParticipantResponse.javasrc/main/java/team/wego/wegobackend/chat/application/service/ChatRoomService.javasrc/main/java/team/wego/wegobackend/chat/domain/entity/ChatRoom.java
🔇 Additional comments (9)
src/main/java/team/wego/wegobackend/chat/application/dto/response/ChatRoomItemResponse.java (1)
7-37: LGTM! 썸네일 필드 추가가 적절합니다레코드에
thumbnail필드를 추가하고 팩토리 메서드에서 올바르게 전달하고 있습니다. 구현이 명확하고 일관성 있습니다.src/main/java/team/wego/wegobackend/chat/application/dto/response/ChatRoomResponse.java (1)
8-36: LGTM! 일관된 구조로 썸네일 필드 추가
ChatRoomItemResponse와 동일한 패턴으로 썸네일 필드가 추가되어 일관성이 유지되고 있습니다.src/main/java/team/wego/wegobackend/chat/application/dto/response/ParticipantResponse.java (1)
7-26: LGTM! 방장 식별 기능이 적절히 구현됨
isOwner필드와 팩토리 메서드가 명확하게 구현되어 있으며, 방장 정보를 응답에 포함시키는 요구사항을 잘 충족합니다.src/main/java/team/wego/wegobackend/chat/application/service/ChatRoomService.java (5)
69-84: 채팅방 상세 조회 로직 개선이 적절함방장 정보와 썸네일을 응답에 포함시키는 로직이 명확하게 구현되어 있습니다.
getHostId()와resolveThumbnail을 활용한 구조가 깔끔합니다.
89-101: 참여자 목록 조회에 방장 정보 추가가 일관성 있게 구현됨
getChatRoom과 동일한 패턴으로 방장 식별 로직이 적용되어 코드베이스의 일관성이 유지됩니다.
352-357: LGTM! 방장 확인 헬퍼 메서드가 간결하게 구현됨null 체크를 포함한 명확한 로직으로 구현되어 있습니다.
281-310: 응답 빌더 메서드들이 새로운 필드를 적절히 통합함
buildChatRoomItem과buildChatRoomResponse모두 썸네일과 방장 정보를 일관되게 처리하고 있습니다. 헬퍼 메서드들을 잘 활용하여 코드 중복을 최소화했습니다.
326-350: 구현이 올바릅니다.findAllByGroupIdWithVariants메서드는 정의되어 있으며,left join fetch를 통해 variants를 eager loading으로 함께 조회합니다. 사용 방식도 적절합니다.src/main/java/team/wego/wegobackend/chat/domain/entity/ChatRoom.java (1)
91-96: 코드는 NPE 위험이 없습니다 - 호스트는 항상 non-null입니다
GroupV2의host필드는 데이터베이스 수준에서@JoinColumn(name = "host_id", nullable = false)와@ManyToOne(optional = false)제약조건이 있어 절대 null이 될 수 없습니다. 따라서 라인 92에서group != null검사를 통과한 후에는group.getHost()가 항상 null이 아닌 User 객체를 반환하므로 NPE는 발생하지 않습니다. 이 패턴은 코드베이스의 40개 이상의 위치에서 동일하게 사용되고 있습니다.Likely an incorrect or invalid review comment.
src/main/java/team/wego/wegobackend/chat/application/service/ChatRoomService.java
Show resolved
Hide resolved
- 모임 조회 시 채팅방 ID도 함께 전달 - 모임 승인제 채팅방 참여 이벤트 추가 - 모임 추방 시 채팅방 탈퇴 이벤트 추가
- 기억을 잃어버리고 모임 정보 조회 시 ID를 던지는 로직을 추가를 안하고 커밋을 올려, 재커밋
📝 Pull Request
📌 PR 종류
해당하는 항목에 체크해주세요.
✨ 변경 내용
이번 PR에서 어떤 변경이 이루어졌는지 명확하게 작성해주세요.
아래와 같은 요구사항 및 변경점 있습니다.
채팅방 목록 조회 썸네일 필드 추가
채팅방 상세 조회 시 방장을 나타내는 필드 추가
채팅방 목록 조회 시 최근 메시지 순 정렬
모임 조회 시 해당 채팅방 ID도 함께 전달
모임 승인제 채팅방 참여 이벤트 추가
모임 추방 시 채팅방 탈퇴 이벤트 추가
🔍 관련 이슈
해당 PR이 해결하는 이슈가 있다면 연결해주세요.
🧪 테스트
변경된 기능에 대한 테스트 범위 또는 테스트 결과를 작성해주세요.
클라이언트 통합 테스트 진행 예정
🚨 확인해야 할 사항 (Checklist)
PR을 제출하기 전에 아래 항목들을 확인해주세요.
🙋 기타 참고 사항
리뷰어가 참고하면 좋을 만한 추가 설명이 있다면 적어주세요.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.