Conversation
- FeedCountDto: feedId별 카운트 조회용 interface projection - MyFeedStatDto: 내 피드 통계(feedCount, totalViewCount, imageCount, videoCount) projection - FeedLikeRepository.countsByFeedIds(): N+1 방지 벌크 좋아요 카운트 - FeedCommentRepository.countsByFeedIds(): N+1 방지 벌크 댓글 카운트 (soft delete 필터링) - FeedRepository.findMyFeedStat(): clubId 기반 피드 집계 쿼리 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- FeedListQuery: viewCount, likeCount, commentCount 필드 추가 + 미사용 of() 제거 - FeedQuery: likeCount, commentCount, List<FeedCommentQuery> comments 필드 추가 - MyFeedPageQuery: feedCount, totalViewCount, imageCount, videoCount 추가 + @builder 적용 - FeedFileService.extractFeedThumbnailInfo(): 생성자 → builder 패턴 전환, viewCount 포함 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- FacadeFeedService: buildFeedListQueriesWithCounts()로 목록 API 벌크 카운트 주입 - FacadeFeedService.getById(): likeCount, commentCount, comments 조회 추가 - FacadeClubFeedServiceImpl.getMyFeedPage(): findMyFeedStat() 집계 + null 시 stat 유지 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- FeedPageResponse: viewCount, likeCount, commentCount 추가 - ClubFeedPageResponse: viewCount, likeCount, commentCount 추가 + thumbnailFilename 누락 버그 수정 - FeedResponse: likeCount, commentCount, CommentResponse 내부 record + comments 목록 추가 - MyFeedPageResponse: feedCount, totalViewCount, imageCount, videoCount 집계 필드 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (6)
Walkthrough피드 도메인에 조회수·좋아요·댓글 집계가 추가되었습니다. 리포지토리에서 집계 쿼리(피드별/클럽별)를 제공하고, 서비스는 이를 병합해 확장된 FeedList/Feed/마이피드 페이징 쿼리·응답(댓글 목록 포함)을 반환합니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as Client
participant Ctrl as FeedController
participant Facade as FacadeFeedService
participant FeedRepo as FeedRepository/DB
participant LikeRepo as FeedLikeRepository
participant CommentRepo as FeedCommentRepository
Client->>Ctrl: GET /feeds (요청)
Ctrl->>Facade: getFeedPageByClubId(...)
Facade->>FeedRepo: fetch feeds & paging
Facade->>LikeRepo: countsByFeedIds(feedIds)
Facade->>CommentRepo: countsByFeedIds(feedIds)
Note right of Facade: 매핑 및 ID별 카운트 병합\n(buildFeedListQueriesWithCounts)
Facade->>FeedRepo: findMyFeedStat(clubId)
Facade->>Ctrl: 구성된 FeedPage/MyFeedPage 응답 반환
Ctrl->>Client: HTTP 200 응답 (view/like/comment 포함)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java (1)
60-70:⚠️ Potential issue | 🟡 Minor상세 조회 시
commentCount와comments.size()간 불일치 가능성.
commentCount는feedCommentService.countByFeedId()로 별도 조회하고,comments는feedCommentService.getAllByFeedId()로 조회합니다. 두 쿼리 사이에 댓글이 추가/삭제되면commentCount != comments.size()가 될 수 있습니다.
commentCount를 별도로 쿼리하지 않고comments.size()를 사용하는 것이 일관성 측면에서 더 안전합니다.♻️ 제안
public FeedQuery getById(Long feedId) { feedService.incrementViewCount(feedId); Feed feed = feedService.getById(feedId); ClubProfileQuery clubProfileQuery = feedFileService.extractClubInfo(feed.getClub()); FeedFileInfoQuery feedFileInfoQuery = feedFileService.extractFeedFileInfo(feed); long likeCount = feedLikeService.countByFeedId(feedId); - long commentCount = feedCommentService.countByFeedId(feedId); List<FeedCommentQuery> comments = feedCommentService.getAllByFeedId(feedId); - return FeedQuery.of(feed, clubProfileQuery, feedFileInfoQuery, likeCount, commentCount, comments); + return FeedQuery.of(feed, clubProfileQuery, feedFileInfoQuery, likeCount, comments.size(), comments); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java` around lines 60 - 70, In getById, avoid the race between feedCommentService.countByFeedId(...) and feedCommentService.getAllByFeedId(...) by removing the separate count call and deriving commentCount from the retrieved comments list (i.e., set commentCount = comments.size()); update the code that builds the return value (FeedQuery.of(...)) to use that computed commentCount instead of the removed count variable so getById, comments, and FeedQuery.of remain consistent.
🧹 Nitpick comments (4)
src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java (2)
87-98:FeedListQuery필드 수동 복사는 유지보수에 취약합니다.
FeedListQuery에 새 필드가 추가될 경우 이 빌더 코드에서 누락될 수 있습니다.FeedListQuery에 카운트를 주입하는withCounts(long likeCount, long commentCount)같은 팩토리 메서드를 추가하면 복사 로직을 DTO 내부에 캡슐화할 수 있습니다.♻️ FeedListQuery에 withCounts 메서드 추가 예시
FeedListQuery에 다음 메서드를 추가:public FeedListQuery withCounts(long likeCount, long commentCount) { return FeedListQuery.builder() .id(this.id) .thumbnailCdnUrl(this.thumbnailCdnUrl) .thumbnailOriginUrl(this.thumbnailOriginUrl) .thumbnailFileName(this.thumbnailFileName) .feedType(this.feedType) .viewCount(this.viewCount) .likeCount(likeCount) .commentCount(commentCount) .build(); }그리고
buildFeedListQueriesWithCounts에서:return feedListQueries.stream() - .map(q -> FeedListQuery.builder() - .id(q.id()) - .thumbnailCdnUrl(q.thumbnailCdnUrl()) - .thumbnailOriginUrl(q.thumbnailOriginUrl()) - .feedType(q.feedType()) - .thumbnailFileName(q.thumbnailFileName()) - .viewCount(q.viewCount()) - .likeCount(likeCountMap.getOrDefault(q.id(), 0L)) - .commentCount(commentCountMap.getOrDefault(q.id(), 0L)) - .build()) + .map(q -> q.withCounts( + likeCountMap.getOrDefault(q.id(), 0L), + commentCountMap.getOrDefault(q.id(), 0L))) .toList();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java` around lines 87 - 98, The manual field-by-field reconstruction of FeedListQuery in buildFeedListQueriesWithCounts is brittle; add a factory method on FeedListQuery—e.g., withCounts(long likeCount, long commentCount)—that returns a new FeedListQuery preserving all existing fields but overriding likeCount/commentCount, then replace the mapping in FacadeFeedService.buildFeedListQueriesWithCounts to call q.withCounts(likeCountMap.getOrDefault(q.id(),0L), commentCountMap.getOrDefault(q.id(),0L)) so the DTO encapsulates copy logic and future fields aren’t missed.
15-15: 사용되지 않는 import.
java.util.Collections는 이 파일에서 사용되지 않습니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java` at line 15, Remove the unused import java.util.Collections from the FacadeFeedService class; locate the import statement near the top of FacadeFeedService (the line with "import java.util.Collections;") and delete it so the file no longer contains that unused import.src/main/java/ddingdong/ddingdongBE/domain/feed/controller/dto/response/ClubFeedPageResponse.java (1)
24-56:FeedPageResponse.FeedListResponse와 구조가 거의 동일합니다.
ClubFeedListResponse와FeedPageResponse.FeedListResponse가 같은 필드 구성과 매핑 로직을 갖고 있습니다. 향후 필드 추가 시 양쪽 모두 수정해야 하므로, 공통 응답 레코드를 추출하는 것을 고려해볼 수 있습니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/ddingdong/ddingdongBE/domain/feed/controller/dto/response/ClubFeedPageResponse.java` around lines 24 - 56, ClubFeedListResponse duplicates FeedPageResponse.FeedListResponse fields and mapping; extract a single shared record (e.g., FeedListResponseRecord) containing id, thumbnailCdnUrl, thumbnailOriginUrl, thumbnailFilename, feedType, viewCount, likeCount, commentCount and a static from(FeedListQuery) factory, place it in a common dto package, then change both ClubFeedListResponse and FeedPageResponse.FeedListResponse to either reuse that shared record directly or delegate to it (replace their builder/from logic to call FeedListResponseRecord.from and map/return that instance) so future field additions require one change.src/main/java/ddingdong/ddingdongBE/domain/feed/controller/dto/response/FeedResponse.java (1)
108-124:query.comments()null 체크는 방어적이지만, 상위에서 보장하는 것이 더 좋습니다.현재
FeedQuery.of()에서comments를 그대로 전달하므로, 호출자가null을 넘기면 여기서 빈 리스트로 대체됩니다. 가능하다면FeedQuery.of()내부에서comments == null ? List.of() : comments로 보장하면 하위 코드의 방어 로직이 불필요해집니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/ddingdong/ddingdongBE/domain/feed/controller/dto/response/FeedResponse.java` around lines 108 - 124, FeedResponse.from currently defensively null-checks query.comments(), but the construct should be enforced at the source: update FeedQuery.of (the factory/constructor that builds FeedQuery) to normalize comments by replacing a null comments parameter with an empty List (e.g., comments == null ? List.of() : comments) so callers of FeedResponse.from can assume query.comments() is non-null and you can remove the defensive null-handling in FeedResponse.from; ensure the change targets FeedQuery.of and keep the public API of FeedQuery.comments() unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/repository/FeedRepository.java`:
- Around line 103-112: The aggregation query in findMyFeedStat is missing
COALESCE for imageCount and videoCount so SUM(CASE ...) can return NULL for
clubs with no feeds; update the nativeQuery to wrap both SUM(CASE WHEN
f.feed_type = 'IMAGE' THEN 1 ELSE 0 END) and SUM(CASE WHEN f.feed_type = 'VIDEO'
THEN 1 ELSE 0 END) with COALESCE(..., 0) so MyFeedStatDto getters (and
downstream MyFeedPageQuery which may unbox to primitive long) always receive 0
instead of null.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/dto/query/MyFeedPageQuery.java`:
- Around line 18-28: MyFeedPageQuery.of currently passes stat.getImageCount()
and stat.getVideoCount() (which can be null) into primitive long fields causing
NPEs; fix by guarding against nulls in the of() method (e.g., use a
null-coalescing default 0L when reading
stat.getImageCount()/stat.getVideoCount()) or alternatively update the SQL to
use COALESCE around the SUMs so stat.getImageCount()/getVideoCount() never
return null; modify the MyFeedPageQuery.of implementation to use the chosen
approach and ensure the builder receives non-null long values for imageCount and
videoCount.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeClubFeedServiceImpl.java`:
- Line 42: Replace the direct FeedRepository dependency in
FacadeClubFeedServiceImpl with a FeedService dependency: remove or replace the
private final FeedRepository feedRepository field and constructor parameter with
FeedService feedService, and update all usages of
feedRepository.findMyFeedStat(...) to delegate to
feedService.findMyFeedStat(...). This keeps the facade from depending on the
repository directly and mirrors the fix already used in FacadeFeedService.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java`:
- Around line 33-34: FacadeFeedService currently depends directly on
FeedLikeRepository and FeedCommentRepository which breaks DDD layering and is
inconsistent with using FeedLikeService/FeedCommentService elsewhere; remove the
FeedLikeRepository and FeedCommentRepository fields from FacadeFeedService and
delegate the bulk count work to new methods countsByFeedIds(List<Long>) on
FeedLikeService and FeedCommentService (add these service methods and have them
call their repositories internally), then update the FacadeFeedService code
paths that used the repositories (the list retrieval around the existing
repository calls) to call FeedLikeService.countsByFeedIds(...) and
FeedCommentService.countsByFeedIds(...) instead.
---
Outside diff comments:
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java`:
- Around line 60-70: In getById, avoid the race between
feedCommentService.countByFeedId(...) and feedCommentService.getAllByFeedId(...)
by removing the separate count call and deriving commentCount from the retrieved
comments list (i.e., set commentCount = comments.size()); update the code that
builds the return value (FeedQuery.of(...)) to use that computed commentCount
instead of the removed count variable so getById, comments, and FeedQuery.of
remain consistent.
---
Duplicate comments:
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/repository/FeedLikeRepository.java`:
- Around line 18-24: The countsByFeedIds method in FeedLikeRepository can fail
when given an empty feedIds list (causing an IN () SQL error); mirror the fix
used in FeedCommentRepository by short-circuiting when feedIds is null or empty
and returning an empty List before invoking the repository query. Locate
FeedLikeRepository.countsByFeedIds and add the defensive check (return
Collections.emptyList() or equivalent) so the native query is never called with
an empty collection.
---
Nitpick comments:
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/controller/dto/response/ClubFeedPageResponse.java`:
- Around line 24-56: ClubFeedListResponse duplicates
FeedPageResponse.FeedListResponse fields and mapping; extract a single shared
record (e.g., FeedListResponseRecord) containing id, thumbnailCdnUrl,
thumbnailOriginUrl, thumbnailFilename, feedType, viewCount, likeCount,
commentCount and a static from(FeedListQuery) factory, place it in a common dto
package, then change both ClubFeedListResponse and
FeedPageResponse.FeedListResponse to either reuse that shared record directly or
delegate to it (replace their builder/from logic to call
FeedListResponseRecord.from and map/return that instance) so future field
additions require one change.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/controller/dto/response/FeedResponse.java`:
- Around line 108-124: FeedResponse.from currently defensively null-checks
query.comments(), but the construct should be enforced at the source: update
FeedQuery.of (the factory/constructor that builds FeedQuery) to normalize
comments by replacing a null comments parameter with an empty List (e.g.,
comments == null ? List.of() : comments) so callers of FeedResponse.from can
assume query.comments() is non-null and you can remove the defensive
null-handling in FeedResponse.from; ensure the change targets FeedQuery.of and
keep the public API of FeedQuery.comments() unchanged.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java`:
- Around line 87-98: The manual field-by-field reconstruction of FeedListQuery
in buildFeedListQueriesWithCounts is brittle; add a factory method on
FeedListQuery—e.g., withCounts(long likeCount, long commentCount)—that returns a
new FeedListQuery preserving all existing fields but overriding
likeCount/commentCount, then replace the mapping in
FacadeFeedService.buildFeedListQueriesWithCounts to call
q.withCounts(likeCountMap.getOrDefault(q.id(),0L),
commentCountMap.getOrDefault(q.id(),0L)) so the DTO encapsulates copy logic and
future fields aren’t missed.
- Line 15: Remove the unused import java.util.Collections from the
FacadeFeedService class; locate the import statement near the top of
FacadeFeedService (the line with "import java.util.Collections;") and delete it
so the file no longer contains that unused import.
src/main/java/ddingdong/ddingdongBE/domain/feed/repository/FeedRepository.java
Show resolved
Hide resolved
src/main/java/ddingdong/ddingdongBE/domain/feed/service/dto/query/MyFeedPageQuery.java
Show resolved
Hide resolved
| private final VodProcessingJobService vodProcessingJobService; | ||
| private final SseConnectionService sseConnectionService; | ||
| private final FeedFileService feedFileService; | ||
| private final FeedRepository feedRepository; |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
FeedRepository 직접 의존 — FeedService를 통해 접근해야 합니다.
FacadeFeedService와 동일한 문제입니다. findMyFeedStat()을 FeedService에 위임하면 Facade가 Repository에 직접 의존하지 않게 됩니다.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeClubFeedServiceImpl.java`
at line 42, Replace the direct FeedRepository dependency in
FacadeClubFeedServiceImpl with a FeedService dependency: remove or replace the
private final FeedRepository feedRepository field and constructor parameter with
FeedService feedService, and update all usages of
feedRepository.findMyFeedStat(...) to delegate to
feedService.findMyFeedStat(...). This keeps the facade from depending on the
repository directly and mirrors the fix already used in FacadeFeedService.
| private final FeedLikeRepository feedLikeRepository; | ||
| private final FeedCommentRepository feedCommentRepository; |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Facade에서 Repository 직접 의존은 DDD 레이어링 위반입니다.
FacadeFeedService가 FeedLikeRepository와 FeedCommentRepository를 직접 주입받고 있습니다. Line 66-68의 상세 조회에서는 FeedLikeService/FeedCommentService를 통해 접근하면서, Line 82-85의 목록 조회에서는 Repository를 직접 사용하는 것은 일관성이 없습니다.
벌크 카운트 메서드(countsByFeedIds)를 각 도메인 서비스(FeedLikeService, FeedCommentService)로 위임하면 Repository 의존을 제거할 수 있습니다.
♻️ 제안
public class FacadeFeedService {
private final FeedService feedService;
private final FeedFileService feedFileService;
private final FeedLikeService feedLikeService;
private final FeedCommentService feedCommentService;
- private final FeedLikeRepository feedLikeRepository;
- private final FeedCommentRepository feedCommentRepository;그리고 FeedLikeService/FeedCommentService에 벌크 카운트 메서드를 추가:
// FeedLikeService
List<FeedCountDto> countsByFeedIds(List<Long> feedIds);
// FeedCommentService
List<FeedCountDto> countsByFeedIds(List<Long> feedIds);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/main/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedService.java`
around lines 33 - 34, FacadeFeedService currently depends directly on
FeedLikeRepository and FeedCommentRepository which breaks DDD layering and is
inconsistent with using FeedLikeService/FeedCommentService elsewhere; remove the
FeedLikeRepository and FeedCommentRepository fields from FacadeFeedService and
delegate the bulk count work to new methods countsByFeedIds(List<Long>) on
FeedLikeService and FeedCommentService (add these service methods and have them
call their repositories internally), then update the FacadeFeedService code
paths that used the repositories (the list retrieval around the existing
repository calls) to call FeedLikeService.countsByFeedIds(...) and
FeedCommentService.countsByFeedIds(...) instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java (1)
67-73:⚠️ Potential issue | 🟡 Minor
setUp()에서feedLikeRepository와feedCommentRepository정리가 누락되었습니다.새 테스트(
getFeedById_WithLikesAndComments)에서 좋아요와 댓글을 저장하지만,setUp()에서 이들을 삭제하지 않습니다. 테스트 실행 순서에 따라 잔여 데이터가 다른 테스트에 영향을 줄 수 있습니다. FK 제약조건 순서를 고려하여 피드 삭제 전에 좋아요/댓글을 먼저 삭제해야 합니다.🐛 수정 제안
`@BeforeEach` void setUp() { + feedCommentRepository.deleteAll(); + feedCommentRepository.flush(); + feedLikeRepository.deleteAll(); + feedLikeRepository.flush(); feedRepository.deleteAll(); feedRepository.flush(); clubRepository.deleteAll(); clubRepository.flush(); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java` around lines 67 - 73, Update the setUp() method to also clear feedLikeRepository and feedCommentRepository and ensure they are deleted before feedRepository to respect FK constraints: call feedLikeRepository.deleteAll() and feedCommentRepository.deleteAll() prior to feedRepository.deleteAll()/flush() inside setUp() so likes/comments from previous tests cannot leak into new tests like getFeedById_WithLikesAndComments.
🧹 Nitpick comments (1)
src/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java (1)
187-189:FeedFixture헬퍼 메서드 사용을 권장합니다.다른 테스트 파일(
FeedLikeRepositoryTest,FeedCommentRepositoryTest)에서는FeedFixture.createFeedLike()/FeedFixture.createFeedComment()를 일관되게 사용하고 있습니다. 여기서도 동일하게 사용하면 테스트 코드의 일관성이 높아집니다.♻️ 수정 제안
- feedLikeRepository.save(FeedLike.builder().feed(savedFeed).uuid("uuid-1").build()); - feedLikeRepository.save(FeedLike.builder().feed(savedFeed).uuid("uuid-2").build()); - feedCommentRepository.save(FeedComment.builder().feed(savedFeed).uuid("uuid-3").anonymousNumber(1).content("댓글 1").build()); + feedLikeRepository.save(FeedFixture.createFeedLike(savedFeed, "uuid-1")); + feedLikeRepository.save(FeedFixture.createFeedLike(savedFeed, "uuid-2")); + feedCommentRepository.save(FeedFixture.createFeedComment(savedFeed, "uuid-3", 1, "댓글 1"));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java` around lines 187 - 189, 현재 테스트에서 직접 FeedLike/FeedComment 엔티티를 생성해 저장하고 있는데, 동일한 패턴을 다른 테스트들(FeedLikeRepositoryTest, FeedCommentRepositoryTest)에서 사용 중인 헬퍼 메서드로 통일하세요: savedFeed를 인자로 FeedFixture.createFeedLike(savedFeed, "uuid-1") / FeedFixture.createFeedLike(savedFeed, "uuid-2") 및 FeedFixture.createFeedComment(savedFeed, "uuid-3", 1, "댓글 1") 호출로 교체하고 반환된 엔티티를 feedLikeRepository.save(...) / feedCommentRepository.save(...) 대신 바로 저장하거나 필요시 저장 호출로 일관되게 사용하도록 수정하세요.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/ddingdong/ddingdongBE/domain/feed/repository/FeedRepository.javasrc/test/java/ddingdong/ddingdongBE/domain/feed/repository/FeedCommentRepositoryTest.javasrc/test/java/ddingdong/ddingdongBE/domain/feed/repository/FeedLikeRepositoryTest.javasrc/test/java/ddingdong/ddingdongBE/domain/feed/repository/FeedRepositoryTest.javasrc/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@src/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java`:
- Around line 67-73: Update the setUp() method to also clear feedLikeRepository
and feedCommentRepository and ensure they are deleted before feedRepository to
respect FK constraints: call feedLikeRepository.deleteAll() and
feedCommentRepository.deleteAll() prior to feedRepository.deleteAll()/flush()
inside setUp() so likes/comments from previous tests cannot leak into new tests
like getFeedById_WithLikesAndComments.
---
Nitpick comments:
In
`@src/test/java/ddingdong/ddingdongBE/domain/feed/service/FacadeFeedServiceTest.java`:
- Around line 187-189: 현재 테스트에서 직접 FeedLike/FeedComment 엔티티를 생성해 저장하고 있는데, 동일한
패턴을 다른 테스트들(FeedLikeRepositoryTest, FeedCommentRepositoryTest)에서 사용 중인 헬퍼 메서드로
통일하세요: savedFeed를 인자로 FeedFixture.createFeedLike(savedFeed, "uuid-1") /
FeedFixture.createFeedLike(savedFeed, "uuid-2") 및
FeedFixture.createFeedComment(savedFeed, "uuid-3", 1, "댓글 1") 호출로 교체하고 반환된 엔티티를
feedLikeRepository.save(...) / feedCommentRepository.save(...) 대신 바로 저장하거나 필요시
저장 호출로 일관되게 사용하도록 수정하세요.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| .id(feedListQuery.id()) | ||
| .thumbnailCdnUrl(feedListQuery.thumbnailCdnUrl()) | ||
| .thumbnailOriginUrl(feedListQuery.thumbnailOriginUrl()) | ||
| .thumbnailFilename(feedListQuery.thumbnailFileName()) |
There was a problem hiding this comment.
현 api 명세에 해당 필드는 제거해도 될 것 같아
| @Schema(description = "이미지 피드 수", example = "10") | ||
| long imageCount, | ||
| @Schema(description = "영상 피드 수", example = "5") | ||
| long videoCount, |
There was a problem hiding this comment.
요구사항이 변경되어 해당 필드는 명세에서 삭제해도 될 것 같아
| @Import(JpaAuditingConfig.class) | ||
| class FeedCommentRepositoryTest extends DataJpaTestSupport { |
There was a problem hiding this comment.
Import DataJpaTestSupport 내부에 넣어도 될 것 같아요
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit c7dfa5a)
🚀 작업 내용
기존 피드 조회 API 4종에 좋아요/댓글/조회수 관련 필드를 추가합니다.
수정 대상 API
/server/feedsviewCount,likeCount,commentCount/server/feeds/{feedId}likeCount,commentCount,comments[]/server/clubs/{clubId}/feedsviewCount,likeCount,commentCount/server/central/my/feedsfeedCount,totalViewCount주요 변경사항
🤔 고민했던 내용
💬 리뷰 중점사항