Skip to content

[WTH-310] 대시보드 최근 게시글에 좋아요 여부 필드 추가#55

Merged
soo0711 merged 2 commits intodevfrom
refactor/WTH-310-대시보드-최근-게시글에-좋아요-여부-필드-추가
Apr 21, 2026

Hidden character warning

The head ref may contain hidden characters: "refactor/WTH-310-\ub300\uc2dc\ubcf4\ub4dc-\ucd5c\uadfc-\uac8c\uc2dc\uae00\uc5d0-\uc88b\uc544\uc694-\uc5ec\ubd80-\ud544\ub4dc-\ucd94\uac00"
Merged

[WTH-310] 대시보드 최근 게시글에 좋아요 여부 필드 추가#55
soo0711 merged 2 commits intodevfrom
refactor/WTH-310-대시보드-최근-게시글에-좋아요-여부-필드-추가

Conversation

@soo0711
Copy link
Copy Markdown
Collaborator

@soo0711 soo0711 commented Apr 20, 2026

📌 Summary

어떤 작업인지 한 줄 요약해 주세요.

대시보드 최근 게시물 응답에 좋아요 여부 필드 추가

📝 Changes

변경사항을 what, why, how로 구분해 작성해 주세요.

What

대시보드 최근 게시물 응답 수정

Why

좋아요 여부를 확인하기 위해

How

isLiked 필드 추가

📸 Screenshots / Logs

필요시 스크린샷 or 로그를 첨부해주세요.

스크린샷 2026-04-20 오후 5 33 07 스크린샷 2026-04-20 오후 5 33 28

💡 Reviewer 참고사항

리뷰에 참고할 내용을 작성해주세요.

✅ Checklist

  • PR 제목 설정 완료 (WTH-123 인증 필터 설정)
  • 테스트 구현 완료
  • 리뷰어 등록 완료
  • 자체 코드 리뷰 완료

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 대시보드에서 각 게시물에 대해 사용자의 좋아요 여부를 개별적으로 추적하고 표시합니다.
    • 좋아요 정보가 더 상세한 구조로 제공되어 사용자 경험이 개선됩니다.

@soo0711 soo0711 requested a review from hyxklee April 20, 2026 11:14
@soo0711 soo0711 self-assigned this Apr 20, 2026
@soo0711 soo0711 added the 🔨 Refactor 코드 구조 개선 및 리팩토링 label Apr 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

개요

PostLikeReader 인터페이스를 도입하고 PostLikeRepository에서 구현하며, DashboardPostResponse의 좋아요 표현을 단순 카운트에서 구조화된 PostLikeResponse 객체로 변경하고, 대시보드 조회 시 사용자별 게시글 좋아요 여부를 확인하는 로직을 추가했습니다.

변경사항

코호트 / 파일 요약
PostLikeReader 인터페이스 추출
src/main/kotlin/com/weeth/domain/board/domain/repository/PostLikeReader.kt, src/main/kotlin/com/weeth/domain/board/domain/repository/PostLikeRepository.kt
새로운 PostLikeReader 인터페이스를 정의하고 PostLikeRepository에서 구현하여 좋아요 조회 기능을 추상화했습니다.
대시보드 응답 구조 변경
src/main/kotlin/com/weeth/domain/dashboard/application/dto/response/DashboardPostResponse.kt, src/main/kotlin/com/weeth/domain/dashboard/application/mapper/DashboardMapper.kt
좋아요 정보를 likeCount: Int에서 like: PostLikeResponse 구조로 변경하고, 매퍼에 isLiked 파라미터를 추가했습니다.
대시보드 조회 로직 개선
src/main/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryService.kt, src/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt
PostLikeReader 의존성을 주입받아 게시글 목록 조회 시 사용자별 좋아요 여부를 조회하고 응답에 포함하도록 수정했습니다.

시퀀스 다이어그램

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>
Loading

예상 코드 리뷰 시간

🎯 3 (Moderate) | ⏱️ ~20 분

관련 PR

  • [WTH-206] 게시글 좋아요 api #38: PostLikeRepository.findLikedPostIds 메서드와 좋아요 관련 DTO/매핑을 추가한 PR로, 이 PR에서 추출한 PostLikeReader 인터페이스와 동일한 기능을 구현합니다.

제안된 레이블

✨ Feature

제안된 리뷰어

  • hyxklee

축하 시

🐰 토끼 여기 왔네요!
좋아요 구조를 다시 짜고
PostLikeReader 춤을 추며
대시보드는 더욱 멋져졌어요! ✨
리더 인터페이스 환영합니다! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확하게 요약하고 있습니다. 대시보드 최근 게시글에 좋아요 여부 필드를 추가하는 것이 주요 변경사항이며, 제목이 이를 정확하게 반영합니다.
Description check ✅ Passed PR 설명이 템플릿의 기본 구조를 따르고 있으나, '💡 Reviewer 참고사항' 섹션이 비어있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/WTH-310-대시보드-최근-게시글에-좋아요-여부-필드-추가

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt (1)

189-195: isLiked = true 경로도 테스트해 주세요.

현재 추가된 스텁은 모두 emptySet()이라 새 기능의 핵심인 “현재 사용자가 좋아요한 게시글이면 like.isLikedtrue”인 경로를 검증하지 못합니다. findLikedPostIdssetOf(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

📥 Commits

Reviewing files that changed from the base of the PR and between ecd5685 and c5d7cda.

📒 Files selected for processing (6)
  • src/main/kotlin/com/weeth/domain/board/domain/repository/PostLikeReader.kt
  • src/main/kotlin/com/weeth/domain/board/domain/repository/PostLikeRepository.kt
  • src/main/kotlin/com/weeth/domain/dashboard/application/dto/response/DashboardPostResponse.kt
  • src/main/kotlin/com/weeth/domain/dashboard/application/mapper/DashboardMapper.kt
  • src/main/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryService.kt
  • src/test/kotlin/com/weeth/domain/dashboard/application/usecase/query/GetDashboardQueryServiceTest.kt

@soo0711 soo0711 merged commit e25a054 into dev Apr 21, 2026
2 checks passed
@soo0711 soo0711 deleted the refactor/WTH-310-대시보드-최근-게시글에-좋아요-여부-필드-추가 branch April 21, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 코드 구조 개선 및 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants