[Feat]#105 커뮤니티 응답에 작성자 프로필 이미지/캐릭터 코드 추가 - #109
Conversation
게시글 목록/상세, 댓글 목록 응답에 작성자의 profileImageUrl 과 characterCode 를 추가한다. 프로필 이미지를 등록하지 않은 사용자는 profileImageUrl 이 null 이므로 characterCode 로 대체 표시한다. - 목록 조회는 기존 작성자 projection 이 이미 UserProfile 을 LEFT JOIN 하고 있어, SELECT 절에 컬럼만 추가해 추가 쿼리 없이 처리한다. - getWriters() 의 반환 타입을 projection 으로 변경하면서, Collectors.toMap 의 null value 방어용이던 닉네임 null 필터를 제거한다(값이 projection 객체라 null 이 될 수 없다). 응답 동작은 동일하다. - 댓글 목록은 작성자 프로필을 한 번만 조회해 세 필드를 함께 사용하므로 기존과 쿼리 수가 같다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthrough커뮤니티 게시글과 댓글 응답에 작성자의 Changes커뮤니티 작성자 프로필 응답
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant CommunityService
participant CommunityRepository
participant CommunityConverter
Client->>CommunityService: 게시글 목록 조회
CommunityService->>CommunityRepository: 작성자 projection 조회
CommunityRepository-->>CommunityService: 닉네임, 프로필 이미지 키, 캐릭터 코드
CommunityService->>CommunityConverter: 게시글과 작성자 정보 전달
CommunityConverter-->>Client: 프로필 정보가 포함된 응답 반환
Possibly related issues
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 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.
Pull request overview
커뮤니티 게시글 목록/상세 및 댓글 목록 응답에 작성자 프로필 정보(profileImageUrl, characterCode)를 포함하도록 DTO/Converter/Service/Repository를 확장한 PR입니다. 기존 조회 흐름을 유지하면서(특히 목록 조회는 writer projection 기반) 응답 필드를 확장해 UI에서 프로필 이미지가 없을 때 캐릭터 코드로 대체 표시할 수 있게 합니다.
Changes:
- 커뮤니티 목록/상세/댓글 응답 DTO에
profileImageUrl,characterCode필드 추가 - 목록 조회용 작성자 projection을 닉네임 → (닉네임/프로필 이미지 키/캐릭터 코드)로 확장
- 서비스 레이어에서 프로필 조회 헬퍼를 도입하고 converter 호출 시 신규 필드 전달
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/redo/domain/community/service/CommunityService.java | 목록/상세/댓글 응답 생성 시 작성자 프로필 필드까지 포함하도록 조회/매핑 로직 확장 |
| src/main/java/com/redo/domain/community/repository/CommunityRepository.java | 목록 조회용 writer projection 쿼리에 profileImageKey, characterCode 컬럼 추가 |
| src/main/java/com/redo/domain/community/dto/res/CommunityResponseDTO.java | 목록 응답 DTO에 작성자 프로필 필드 추가 |
| src/main/java/com/redo/domain/community/dto/res/CommunityDetailResponseDTO.java | 상세 응답 DTO에 작성자 프로필 필드 추가 |
| src/main/java/com/redo/domain/community/dto/res/CommunityCommentResponseDTO.java | 댓글 응답 DTO에 작성자 프로필 필드 추가 |
| src/main/java/com/redo/domain/community/converter/CommunityConverter.java | 신규 DTO 필드 반영을 위한 converter 시그니처/매핑 수정 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public static CommunityResponseDTO toCommunityResponse( | ||
| Community community, | ||
| long numComments, | ||
| String imageUrl, | ||
| String writer | ||
| String writer, | ||
| String profileImageUrl, | ||
| String characterCode | ||
| ) { | ||
| return new CommunityResponseDTO( | ||
| community.getId(), | ||
| numComments, | ||
| community.getLikeCount() == null ? 0 : community.getLikeCount(), | ||
| community.getCreatedAt(), | ||
| imageUrl, | ||
| community.getTitle(), | ||
| String.valueOf(community.getCategory().getCode()), | ||
| toPreview(community.getContent()), | ||
| writer | ||
| writer, | ||
| profileImageUrl, | ||
| characterCode | ||
| ); |
| return CommunityConverter.toCommunityCommentListResponse( | ||
| comments.stream() | ||
| .map(comment -> CommunityConverter.toCommunityCommentResponse( | ||
| comment, | ||
| getNickname(comment.getUser().getId()) | ||
| )) | ||
| .map(comment -> { | ||
| UserProfile profile = getProfile(comment.getUser().getId()); | ||
|
|
||
| return CommunityConverter.toCommunityCommentResponse( | ||
| comment, | ||
| getNickname(profile), | ||
| getProfileImageUrl(profile), | ||
| getCharacterCode(profile) | ||
| ); | ||
| }) | ||
| .toList() | ||
| ); |
게시글 목록/상세, 댓글 목록 응답에 작성자의 profileImageUrl 과
characterCode 를 추가한다. 프로필 이미지를 등록하지 않은 사용자는
profileImageUrl 이 null 이므로 characterCode 로 대체 표시한다.
#️⃣연관된 이슈
📝작업 내용
스크린샷 (선택)
💬리뷰 요구사항(선택)
PR 전 필수 체크리스트
테스트 결과
Summary by CodeRabbit