Skip to content

[REFACTOR] 동행 게시물 목록 조회 응답에 전체 건수 추가 - #172

Merged
beneruufin merged 3 commits into
developfrom
refactor/#171/post-total-count
Sep 28, 2026
Merged

beneruufin merged 3 commits into
developfrom
refactor/#171/post-total-count

Conversation

@beneruufin

@beneruufin beneruufin commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

📌 관련 이슈

Closes #171

✨ 작업 내용

  • 동행 게시물 목록 응답에 totalElements를 추가
  • 일반 목록과 통합 검색에서는 삭제되거나 모집 완료된 게시물을 건수에서 제외
  • 저장 목록에서는 사용자가 저장한 게시물 중 삭제되지 않은 게시물의 전체 건수를 반환

✅ 체크리스트

  • Reviewer를 지정해 주세요.
  • Assignee를 지정해 주세요.
  • Label을 지정해 주세요.

💡 참고 사항

리뷰어가 알아야 할 내용을 작성해주세요.

Summary by CodeRabbit

  • 새 기능
    • 게시글 목록, 저장한 게시글 목록, 통합 검색 결과에 조건에 맞는 전체 게시글 수가 표시됩니다. 페이지 번호나 크기와 관계없이 전체 건수를 확인할 수 있으며, 저장 목록에는 삭제되지 않은 게시글 수가 반영됩니다.
  • 문서
    • 게시글 목록, 저장한 게시글 목록, 통합 검색 API 설명에 전체 건수의 집계 기준을 명시했습니다.

@beneruufin beneruufin self-assigned this Sep 27, 2026
@beneruufin beneruufin added the ♻️ refactor code refactoring label Sep 27, 2026
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: TEAM-BUDDYS/BUDDYS-SERVER/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 81e0f902-e0a6-4623-a4ab-94e6df332003

📥 Commits

Reviewing files that changed from the base of the PR and between 615f4e2 and 5e59b41.

📒 Files selected for processing (1)
  • src/main/java/org/sopt/buddys/domain/post/repository/PostBookmarkRepository.java
💤 Files with no reviewable changes (1)
  • src/main/java/org/sopt/buddys/domain/post/repository/PostBookmarkRepository.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

게시글 목록과 북마크 목록 응답에 totalElements를 추가합니다. 각 목록의 조회 조건에 맞는 전체 건수를 페이지 정보와 함께 반환합니다. API 설명과 테스트도 집계 기준 및 응답 값을 반영합니다.

Changes

게시글 목록 전체 건수

Layer / File(s) Summary
조회 조건별 전체 건수 집계
src/main/java/org/sopt/buddys/domain/post/repository/*
검색 조건에 맞는 게시글 수와 사용자가 저장한 삭제되지 않은 게시글 수를 조회하는 메서드를 추가합니다.
서비스 결과와 API 응답에 전체 건수 전달
src/main/java/org/sopt/buddys/domain/post/service/*, src/main/java/org/sopt/buddys/domain/post/dto/response/PostListResponse.java, src/main/java/org/sopt/buddys/domain/post/controller/PostController.java, src/main/java/org/sopt/buddys/domain/search/controller/SearchController.java
서비스 결과와 API 응답에 totalElements를 전달합니다. API 설명에 게시글 및 북마크 목록의 집계 기준을 추가합니다.
전체 건수 및 페이지 응답 검증
src/test/java/org/sopt/buddys/domain/post/controller/PostControllerTest.java, src/test/java/org/sopt/buddys/domain/post/service/PostListServiceTest.java, src/test/java/org/sopt/buddys/domain/search/controller/SearchControllerTest.java
게시글 목록, 북마크 목록, 검색 결과의 전체 건수와 페이지 응답 값을 검증합니다.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PostService
  participant PostRepositoryImpl
  participant PostBookmarkRepository
  participant PostListResponse
  PostService->>PostRepositoryImpl: 검색 조건으로 countPosts 조회
  PostService->>PostBookmarkRepository: 사용자 ID로 북마크 게시글 수 조회
  PostService->>PostListResponse: 페이지 결과와 totalElements 전달
Loading

Merge Risk: ⚪ Minimal · up to 5e59b

The new totalElements values match the inspected listing rules. No actionable merge-blocking risk remains after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 615f4

The new totals do not appear to widen access to posts or another user’s bookmarks. The main remaining uncertainty is the cost of running a count for each list request.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new count is exposed through existing post-list responses, including the post portion of integrated search. The inspected flow adds database read work but no new entrypoint or cross-user bookmark-count path.

Trust Boundaries and Controls

  • observed — The post-list endpoints retain authenticated-principal parameters. Unlike the general matching-post count, the saved-post count is explicitly constrained to that principal’s user ID.

Hardening Proposals

  • proposed — Measure count-query cost for broad searches and repeated list requests before rollout; consider request controls if the added database work is material under load.
🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 11 files. 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 제목은 동행 게시물 목록 조회 응답에 전체 건수인 totalElements를 추가하는 PR의 핵심 변경을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed 이슈 #171의 코딩 요구사항을 충족합니다. PostListResponse와 PostListResult에 long totalElements를 추가했습니다. PostService.getPosts는 검색 조건을 적용한 postRepository.countPosts(condition) 결과를 응답에 전달합니다. countPosts는 모집 중…
Out of Scope Changes check ✅ Passed 변경은 이슈 #171의 totalElements 응답 제공과 그 집계 로직에 연결됩니다. API 설명 변경은 응답 의미를 문서화합니다. PostRepository와 PostBookmarkRepository의 집계 메서드 및 관련 테스트는 기능 구현에 필요한 변경입니다. 일반 목록, 통합 검색, 저장 목록의 집계 처리는 동일한 전체 건수 기능을 지…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@beneruufin beneruufin changed the title [REFACTOR] [REFACTOR] 동행 게시물 목록 조회 응답에 전체 건수 추가 Sep 27, 2026

@haerxeong haerxeong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

수고하셧씁니당

@Query("""
select count(pb)
from PostBookmark pb
join pb.post.country

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

country 조인은 필요 없지 않을까용

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

리뷰 감사합니당 제거했어요!!

@beneruufin
beneruufin merged commit f6df706 into develop Sep 28, 2026
4 checks passed
@beneruufin
beneruufin deleted the refactor/#171/post-total-count branch September 28, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 동행 게시물 목록 조회 응답에 전체 건수 추가

2 participants