Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the CARDNEWS feed retrieval logic to fetch policy and contest communities that contain card news images. It introduces a new repository query and maps the retrieved feed items to the CARDNEWS type. The reviewer suggested refactoring the manual mapping of CommunityFeedItemResDTO by adding a withKind helper method to the DTO, which would improve maintainability and prevent errors when fields are added or modified in the future.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (tab == CommunityTab.CARDNEWS) { | ||
| content = content.stream() | ||
| .map(item -> new CommunityFeedItemResDTO( | ||
| CommunityType.CARDNEWS, | ||
| item.communityId(), | ||
| item.pinId(), | ||
| item.title(), | ||
| item.content(), | ||
| item.thumbnailUrl(), | ||
| item.writerNickname(), | ||
| item.writerProfileUrl(), | ||
| item.detailAddress(), | ||
| item.viewCount(), | ||
| item.likeCount(), | ||
| item.discount(), | ||
| item.eventStartTime(), | ||
| item.eventEndTime() | ||
| )) | ||
| .toList(); | ||
| } |
There was a problem hiding this comment.
CommunityFeedItemResDTO 객체의 모든 필드를 수동으로 복사하여 CommunityType.CARDNEWS로 kind만 변경하는 방식은 유지보수 관점에서 취약합니다. 향후 CommunityFeedItemResDTO에 필드가 추가되거나 삭제, 타입 변경이 일어날 경우 이 부분의 생성자 호출 코드도 함께 수정해야 하므로 에러가 발생하기 쉽습니다.
이를 개선하기 위해 CommunityFeedItemResDTO 레코드 내부에 특정 필드만 변경하여 새로운 인스턴스를 반환하는 withKind와 같은 메서드를 추가하는 것을 권장합니다.
추천 개선 방향:
CommunityFeedItemResDTO레코드에 아래와 같은 메서드를 추가합니다:
public CommunityFeedItemResDTO withKind(CommunityType newKind) {
return new CommunityFeedItemResDTO(
newKind,
this.communityId,
this.pinId,
this.title,
this.content,
this.thumbnailUrl,
this.writerNickname,
this.writerProfileUrl,
this.detailAddress,
this.viewCount,
this.likeCount,
this.discount,
this.eventStartTime,
this.eventEndTime
);
}- 서비스 레이어에서는 제공된 코드 제안과 같이 간결하게 처리할 수 있습니다.
if (tab == CommunityTab.CARDNEWS) {
content = content.stream()
.map(item -> item.withKind(CommunityType.CARDNEWS))
.toList();
}[BUG] 새 도메인 url로 변경
🔗 Related Issue
✨ 작업 개요
체크리스트
📷 이미지 첨부 (선택)
🧐 집중 리뷰 요청