Skip to content

Conversation

@uni-j-uni
Copy link
Contributor

@uni-j-uni uni-j-uni commented Dec 15, 2025

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 게시글 카테고리 필터를 선택사항으로 변경하여 카테고리 지정 없이 전체 게시글 조회 가능
  • 개선 사항

    • 게시글 카테고리 필터링 로직 개선으로 더욱 정확한 검색 결과 제공
    • API 문서화 개선: 페이지네이션 커서의 동작 방식(최신순으로 식별자 값 감소) 명확화

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 15, 2025

Walkthrough

포스트 조회 기능의 페이지네이션과 필터링 로직을 리팩토링했습니다. 카테고리 파라미터를 선택사항으로 변경하고, 저장소 쿼리 메서드를 부분 문자열 기반에서 정확한 카테고리 매칭으로 변경했으며, 서비스 로직에서 null/blank 카테고리를 명시적으로 처리하도록 수정했습니다.

Changes

Cohort / File(s) 요약
Controller 매개변수 수정
src/main/java/com/sku/refit/domain/post/controller/PostController.java
category 파라미터 어노테이션을 @RequestParam(required = false)로 변경하여 선택사항으로 설정. lastPostId 파라미터 설명을 업데이트하여 식별자가 최신순으로 감소함을 명시
Repository 쿼리 메서드 리팩토링
src/main/java/com/sku/refit/domain/post/repository/PostRepository.java
findByPostCategoryContainingAndIdLessThanfindAllByUser_IdAndIdLessThan 메서드 제거. findByIdLessThanfindByPostCategoryAndIdLessThan 메서드 추가하여 정확한 카테고리 매칭으로 전환
Service 필터링 로직 개선
src/main/java/com/sku/refit/domain/post/service/PostServiceImpl.java
getPostsByCategory 메서드를 리팩토링하여 카테고리 null/blank 여부로 분기. 부분 문자열 기반 필터를 정확한 카테고리 검증으로 변경하고 PostCategory.valueOf를 통해 유효성 검증. 마지막 커서 계산을 인덱스 기반 접근으로 수정

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • 특별 검토 대상:
    • PostServiceImpl.getPostsByCategory 메서드의 분기 로직이 모든 호출 경로에서 올바르게 동작하는지 확인 필요
    • PostCategory.valueOf 호출 시 예외 처리 및 오류 케이스 검증 필요
    • 저장소 메서드 변경이 다른 부분에서 호출되는지 확인하여 사용하지 않는 메서드가 없는지 점검

Poem

🐰 카테고리를 선택사항으로 만들고,
정확한 매칭으로 갈아탔네!
부분 문자열은 안녕하고,
식별자는 거꾸로 내려가며,
깔끔한 로직이 춤을 춘다~ ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR 설명이 완전히 작성되지 않았습니다. 리포지토리의 필수 템플릿에서 요구하는 모든 섹션(새로운 기능, 개발 상세, 테스트 방법, 추가 고려사항, 관련 문서)이 누락되어 있습니다. 제공된 템플릿을 따라 PR 설명을 작성하세요. 새로운 기능, 구현 방식, 테스트 방법, 그리고 관련 이슈를 명시해주세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경 사항의 주요 내용을 명확하게 반영합니다. 커뮤니티 게시글 전체 조회 기능 추가가 주요 변경 사항이며, 제목이 이를 잘 요약하고 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/chat

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22ab81a and 1d06f3c.

📒 Files selected for processing (3)
  • src/main/java/com/sku/refit/domain/post/controller/PostController.java (1 hunks)
  • src/main/java/com/sku/refit/domain/post/repository/PostRepository.java (1 hunks)
  • src/main/java/com/sku/refit/domain/post/service/PostServiceImpl.java (2 hunks)
🔇 Additional comments (4)
src/main/java/com/sku/refit/domain/post/service/PostServiceImpl.java (2)

158-180: 카테고리 필터링 로직이 올바르게 구현되었습니다.

null/blank 카테고리 처리와 명시적 카테고리 검증이 잘 구현되어 있습니다. 특히:

  • 카테고리가 없는 경우 전체 게시글 조회
  • 카테고리가 있는 경우 PostCategory.valueOf를 통한 검증 및 정확한 매칭
  • lastPostId 기반 커서 페이지네이션 로직

215-215: 커서 계산 로직이 안전하게 구현되었습니다.

빈 리스트 체크와 함께 인덱스 기반 접근이 올바르게 사용되었습니다.

src/main/java/com/sku/refit/domain/post/controller/PostController.java (1)

71-73: API 파라미터 변경이 서비스 로직과 일관되게 적용되었습니다.

카테고리를 선택 사항으로 변경하여 전체 게시글 조회를 지원하고, lastPostId 설명도 명확하게 업데이트되었습니다.

src/main/java/com/sku/refit/domain/post/repository/PostRepository.java (1)

21-23: 새로운 리포지토리 메서드가 올바르게 추가되었습니다.

ID 기반 페이지네이션 메서드들이 서비스 로직의 요구사항을 정확히 지원합니다. 제거된 메서드인 findByPostCategoryContainingAndIdLessThanfindAllByUser_IdAndIdLessThan은 코드베이스 어디에서도 사용되지 않고 있으므로, 안전하게 제거할 수 있습니다.


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.

@uni-j-uni uni-j-uni merged commit 6a5b6e3 into main Dec 15, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants