[WTH-310] 대시보드 최근 게시글에 좋아요 여부 필드 추가#55
Conversation
📝 Walkthrough개요
변경사항
시퀀스 다이어그램sequenceDiagram
participant Client
participant GetDashboardQueryService
participant PostRepository
participant PostLikeReader
participant DashboardMapper
participant DashboardPostResponse
Client->>GetDashboardQueryService: getRecentPosts(userId, pageable)
GetDashboardQueryService->>PostRepository: 최근 게시글 조회
PostRepository-->>GetDashboardQueryService: 게시글 목록
GetDashboardQueryService->>PostLikeReader: findLikedPostIds(postIds, userId)
PostLikeReader-->>GetDashboardQueryService: 좋아요한 게시글 ID 목록
loop 각 게시글마다
GetDashboardQueryService->>DashboardMapper: toPostResponse(post, files, now, isLiked)
DashboardMapper-->>GetDashboardQueryService: DashboardPostResponse
end
GetDashboardQueryService-->>Client: Slice<DashboardPostResponse>
예상 코드 리뷰 시간🎯 3 (Moderate) | ⏱️ ~20 분 관련 PR
제안된 레이블
제안된 리뷰어
축하 시
🚥 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 docstrings
🧪 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.
🧹 Nitpick comments (1)
src/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt (1)
189-195:isLiked = true경로도 테스트해 주세요.현재 추가된 스텁은 모두
emptySet()이라 새 기능의 핵심인 “현재 사용자가 좋아요한 게시글이면like.isLiked가true”인 경로를 검증하지 못합니다.findLikedPostIds가setOf(post.id)를 반환하는 케이스를 하나 추가하면 회귀를 더 잘 막을 수 있습니다.테스트 추가 예시
+ it("사용자가 좋아요한 게시글은 isLiked true로 반환한다") { + val board = BoardTestFixture.create(id = 10L, type = BoardType.GENERAL) + val post = PostTestFixture.create(board = board, clubMember = memberWithUser) + val pageable = PageRequest.of(0, 10) + val slice = SliceImpl(listOf(post), pageable, false) + + every { clubMemberReader.findByClubIdAndUserId(clubId, userId) } returns memberWithUser + every { boardReader.findAllActiveByClubId(clubId) } returns listOf(board) + every { postReader.findRecentByBoardIds(listOf(board.id), any()) } returns slice + every { fileReader.findAll(FileOwnerType.POST, any<List<Long>>()) } returns emptyList() + every { postLikeReader.findLikedPostIds(listOf(post.id), userId) } returns setOf(post.id) + + val result = queryService.getRecentPosts(clubId, userId, 0, 10) + + result.content[0].like.isLiked shouldBe true + }Also applies to: 217-217, 239-239
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt` around lines 189 - 195, Add a complementary test case that stubs postLikeReader.findLikedPostIds to return setOf(post.id) and calls queryService.getRecentPosts(clubId, userId, 0, 10), then assert that result.content[0].like.isLiked is true (while keeping existing assertions for size and fileUrls); specifically update the test around GetDashboardQueryServiceTest to include a branch where findLikedPostIds returns setOf(post.id) to validate the "liked" path for the new feature.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt`:
- Around line 189-195: Add a complementary test case that stubs
postLikeReader.findLikedPostIds to return setOf(post.id) and calls
queryService.getRecentPosts(clubId, userId, 0, 10), then assert that
result.content[0].like.isLiked is true (while keeping existing assertions for
size and fileUrls); specifically update the test around
GetDashboardQueryServiceTest to include a branch where findLikedPostIds returns
setOf(post.id) to validate the "liked" path for the new feature.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f32e5890-7740-4eab-9f76-072c6baea0e6
📒 Files selected for processing (6)
src/main/kotlin/com/weeth/domain/board/domain/repository/PostLikeReader.ktsrc/main/kotlin/com/weeth/domain/board/domain/repository/PostLikeRepository.ktsrc/main/kotlin/com/weeth/domain/dashboard/application/dto/response/DashboardPostResponse.ktsrc/main/kotlin/com/weeth/domain/dashboard/application/mapper/DashboardMapper.ktsrc/main/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryService.ktsrc/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt
📌 Summary
대시보드 최근 게시물 응답에 좋아요 여부 필드 추가
📝 Changes
What
대시보드 최근 게시물 응답 수정
Why
좋아요 여부를 확인하기 위해
How
isLiked 필드 추가
📸 Screenshots / Logs
💡 Reviewer 참고사항
✅ Checklist
Summary by CodeRabbit
릴리스 노트