Skip to content

Feat/#68 내가 쓴 모집글 목록 조회 기능 구현#69

Merged
1winhyun merged 6 commits into
mainfrom
feat/#68
May 28, 2026
Merged

Feat/#68 내가 쓴 모집글 목록 조회 기능 구현#69
1winhyun merged 6 commits into
mainfrom
feat/#68

Conversation

@1winhyun

@1winhyun 1winhyun commented May 28, 2026

Copy link
Copy Markdown
Collaborator

🔗 관련 이슈


✅ PR 유형

어떤 변경 사항이 있었나요?

  • 새로운 기능 추가
  • 버그 수정
  • 리팩토링
  • 코드에 영향을 주지 않는 변경사항(주석, 개행 등등..)
  • 문서 수정
  • 빌드 부분 혹은 패키지 매니저 수정
  • 테스트 코드 추가

✏️ 작업 내용

내가 쓴 모집글 목록 조회 기능을 구현했습니다.

image

💡 추가 사항

Summary by CodeRabbit

Release Notes

  • New Features
    • Added the ability to view all your created roommate recruitment posts, ordered by most recent first
    • Post list displays member count details and post status information
    • Both active and closed posts are included; deleted posts are excluded

Review Change Stack

@1winhyun 1winhyun requested a review from xEzIxX May 28, 2026 16:57
@1winhyun 1winhyun self-assigned this May 28, 2026
@1winhyun 1winhyun linked an issue May 28, 2026 that may be closed by this pull request
1 task
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR implements a new authenticated endpoint GET /api/v1/posts/me that allows users to retrieve their own roommate recruitment posts. The feature includes a complete spec document, response DTO with derivation logic for member counts and closure status, persistence layer queries, use-case orchestration with member aggregation, REST endpoint, and comprehensive test coverage.

Changes

My Roommate Posts Query Feature

Layer / File(s) Summary
Feature specification and requirements
.claude/features/post/007_get_my_roommate_posts.yaml
Specification document defines the GET /api/v1/posts/me endpoint behavior: retrieves all non-deleted user posts ordered by creation date descending, excludes deleted posts, includes both OPEN and CLOSED states, derives totalMemberCount as recruitMemberCount+1, currentMemberCount from active group members, and isClosed from PostStatus; includes data flow, test strategy, and operational notes.
Response DTO contract
src/main/java/com/project/bangjjack/domain/post/application/dto/response/MyRoommatePostResponse.java
Introduces MyRoommatePostResponse record exposing post metadata (postId, title, description, dormitory, roomSize) plus totalMemberCount, currentMemberCount, and isClosed flag; factory method from() maps RoommatePost fields and derives computed fields.
Data access layer
src/main/java/com/project/bangjjack/domain/post/domain/repository/RoommatePostRepository.java, src/main/java/com/project/bangjjack/domain/post/domain/service/RoommatePostGetService.java
Repository adds JPQL query findAllByUserIdAndDeletedFalseOrderByCreatedAtDesc filtering by user and non-deleted status; service layer wraps repository call in getPostsByUserId for reuse.
Use case orchestration
src/main/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCase.java
getMyPosts(userId) fetches user posts, returns empty list if none exist, otherwise derives post IDs, queries active member counts via aggregation service, and maps each post to response DTO (defaulting member count to 0 when aggregation entry missing).
REST endpoint and response code
src/main/java/com/project/bangjjack/domain/post/presentation/RoommatePostController.java, src/main/java/com/project/bangjjack/domain/post/presentation/response/PostResponseCode.java
Controller exposes GET /api/v1/posts/me endpoint returning CommonResponse<List<MyRoommatePostResponse>> by extracting authenticated user ID and delegating to use case; response code enum adds MY_POST_LIST_FOUND with 200 OK status.
Test coverage
src/test/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java
Test suite validates sorting order by postId, isClosed mapping from PostStatus, totalMemberCount as recruitMemberCount+1, currentMemberCount from aggregation, complete response field mappings, empty list return without aggregation query when user has no posts, and correct defaulting to 0 when aggregation map lacks entries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Bangjjack/Bangjjack-Backend#15: Both PRs extend RoommatePostUseCase and RoommatePostRepository to add domain-layer post operations; this PR adds post retrieval while #15 adds post creation.
  • Bangjjack/Bangjjack-Backend#18: Both PRs extend the roommate-post API layer (RoommatePostUseCase and RoommatePostController) with authenticated read operations over non-deleted RoommatePosts.

Suggested labels

✨Feat, ✅Test

Suggested reviewers

  • xEzIxX

Poem

🐰 A post of their own, the authors now see,
Their roommate recruits in one query so free,
From creation dates fresh to the members they've wed,
A clean list returned (with deletions long shed),
No pagination needed—just posts, pure and led! 🏠✨

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main feature being implemented: retrieving a list of recruitment posts written by the authenticated user (내가 쓴 모집글 목록 조회). This directly aligns with all the changes across the specification, DTO, service, usecase, controller, and test files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 feat/#68

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/test/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java`:
- Around line 67-87: The test's DisplayName claims "최신순" but it only verifies
that the mocked roommatePostGetService result order is preserved; update the
DisplayName of the OPEN_CLOSED_모두_반환 test to reflect that it returns all
OPEN/CLOSED posts in the input order (e.g., "입력 순서대로 모든 OPEN/CLOSED 글을 반환한다"),
or alternatively change the setup to mock sorted results if you intend to test
sorting; refer to the OPEN_CLOSED_모두_반환 method, roommatePostUseCase.getMyPosts
call, and the roommatePostGetService mock when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0fd89da2-3f78-4af7-8a4c-5cd69ceffe1b

📥 Commits

Reviewing files that changed from the base of the PR and between ada8b9f and bc0e3f8.

📒 Files selected for processing (8)
  • .claude/features/post/007_get_my_roommate_posts.yaml
  • src/main/java/com/project/bangjjack/domain/post/application/dto/response/MyRoommatePostResponse.java
  • src/main/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCase.java
  • src/main/java/com/project/bangjjack/domain/post/domain/repository/RoommatePostRepository.java
  • src/main/java/com/project/bangjjack/domain/post/domain/service/RoommatePostGetService.java
  • src/main/java/com/project/bangjjack/domain/post/presentation/RoommatePostController.java
  • src/main/java/com/project/bangjjack/domain/post/presentation/response/PostResponseCode.java
  • src/test/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java

Comment on lines +67 to +87
@DisplayName("내가 작성한 OPEN/CLOSED 글을 최신순으로 모두 반환한다")
void OPEN_CLOSED_모두_반환() {
// given
Long userId = 10L;
User owner = user(userId);
RoommatePost openPost = openPost(1L, owner, RoomSize.TWO_PERSON, 1);
RoommatePost closedPost = closedPost(2L, owner, RoomSize.THREE_PERSON, 2);
given(roommatePostGetService.getPostsByUserId(userId)).willReturn(List.of(openPost, closedPost));
given(roommateGroupMemberGetService.countActiveByPostIdIn(List.of(1L, 2L)))
.willReturn(Map.of(1L, 1L, 2L, 3L));

// when
List<MyRoommatePostResponse> result = roommatePostUseCase.getMyPosts(userId);

// then
assertThat(result).hasSize(2);
assertThat(result.get(0).postId()).isEqualTo(1L);
assertThat(result.get(0).isClosed()).isFalse();
assertThat(result.get(1).postId()).isEqualTo(2L);
assertThat(result.get(1).isClosed()).isTrue();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

정렬 검증 의도와 실제 검증 대상이 다릅니다.

Line 67의 “최신순”은 RoommatePostGetService를 mock으로 대체한 현재 테스트에서 보장되지 않습니다. 이 테스트는 정렬 로직 자체가 아니라 “입력 순서 보존”만 확인하고 있어, 이름/설명을 맞추는 게 정확합니다.

✅ Suggested update
-        `@DisplayName`("내가 작성한 OPEN/CLOSED 글을 최신순으로 모두 반환한다")
+        `@DisplayName`("내가 작성한 OPEN/CLOSED 글을 모두 반환하고 입력 순서를 보존한다")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@DisplayName("내가 작성한 OPEN/CLOSED 글을 최신순으로 모두 반환한다")
void OPEN_CLOSED_모두_반환() {
// given
Long userId = 10L;
User owner = user(userId);
RoommatePost openPost = openPost(1L, owner, RoomSize.TWO_PERSON, 1);
RoommatePost closedPost = closedPost(2L, owner, RoomSize.THREE_PERSON, 2);
given(roommatePostGetService.getPostsByUserId(userId)).willReturn(List.of(openPost, closedPost));
given(roommateGroupMemberGetService.countActiveByPostIdIn(List.of(1L, 2L)))
.willReturn(Map.of(1L, 1L, 2L, 3L));
// when
List<MyRoommatePostResponse> result = roommatePostUseCase.getMyPosts(userId);
// then
assertThat(result).hasSize(2);
assertThat(result.get(0).postId()).isEqualTo(1L);
assertThat(result.get(0).isClosed()).isFalse();
assertThat(result.get(1).postId()).isEqualTo(2L);
assertThat(result.get(1).isClosed()).isTrue();
}
`@DisplayName`("내가 작성한 OPEN/CLOSED 글을 모두 반환하고 입력 순서를 보존한다")
void OPEN_CLOSED_모두_반환() {
// given
Long userId = 10L;
User owner = user(userId);
RoommatePost openPost = openPost(1L, owner, RoomSize.TWO_PERSON, 1);
RoommatePost closedPost = closedPost(2L, owner, RoomSize.THREE_PERSON, 2);
given(roommatePostGetService.getPostsByUserId(userId)).willReturn(List.of(openPost, closedPost));
given(roommateGroupMemberGetService.countActiveByPostIdIn(List.of(1L, 2L)))
.willReturn(Map.of(1L, 1L, 2L, 3L));
// when
List<MyRoommatePostResponse> result = roommatePostUseCase.getMyPosts(userId);
// then
assertThat(result).hasSize(2);
assertThat(result.get(0).postId()).isEqualTo(1L);
assertThat(result.get(0).isClosed()).isFalse();
assertThat(result.get(1).postId()).isEqualTo(2L);
assertThat(result.get(1).isClosed()).isTrue();
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/com/project/bangjjack/domain/post/application/usecase/RoommatePostUseCaseGetMyPostsTest.java`
around lines 67 - 87, The test's DisplayName claims "최신순" but it only verifies
that the mocked roommatePostGetService result order is preserved; update the
DisplayName of the OPEN_CLOSED_모두_반환 test to reflect that it returns all
OPEN/CLOSED posts in the input order (e.g., "입력 순서대로 모든 OPEN/CLOSED 글을 반환한다"),
or alternatively change the setup to mock sorted results if you intend to test
sorting; refer to the OPEN_CLOSED_모두_반환 method, roommatePostUseCase.getMyPosts
call, and the roommatePostGetService mock when making the change.

@1winhyun 1winhyun merged commit ea6baf4 into main May 28, 2026
2 checks passed
@1winhyun 1winhyun added ✅Test 테스트 코드 작성 ✨Feat 새로운 기능 개발 labels May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨Feat 새로운 기능 개발 ✅Test 테스트 코드 작성

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 내가 쓴 모집글 조회 기능 구현

1 participant