Skip to content

Conversation

@leegwichan
Copy link
Member

@leegwichan leegwichan commented Jul 30, 2025

✨ 개요

  • '가게 리스트 화면'에서 사용할 카테고리 필터링 구현

🧾 관련 이슈

closed #125

🔍 참고 사항 (선택)

Summary by CodeRabbit

  • 신규 기능
    • 음식점 목록 조회 시 카테고리별로 필터링할 수 있는 기능이 추가되었습니다. 이제 카테고리 파라미터를 통해 원하는 카테고리의 음식점만 확인할 수 있습니다.
  • 버그 수정
    • 카페 카테고리의 표시명이 "카페/디저트"로 변경되었습니다.
  • 테스트
    • 카테고리별 음식점 목록 조회에 대한 테스트가 추가 및 개선되었습니다.
  • 문서화
    • 음식점 목록 조회 API 문서에 카테고리 파라미터 설명이 추가되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jul 30, 2025

Walkthrough

가게 목록 조회 API에 선택적 카테고리(category) 필터링 기능이 추가되었습니다. Controller, Service, Repository 계층이 모두 확장되어, 쿼리 파라미터로 category를 전달하면 해당 카테고리의 가게만 최신순으로 반환합니다. 관련 테스트 및 문서화도 모두 반영되었습니다.

Changes

Cohort / File(s) Change Summary
Controller: 카테고리 파라미터 추가
src/main/java/eatda/controller/store/StoreController.java
getStores 메서드에 선택적 category 파라미터 추가, 서비스 호출부 수정
Service: 카테고리 필터링 로직 도입
src/main/java/eatda/service/store/StoreService.java
getStores 메서드에 category 파라미터 추가, 내부 findStores 메서드로 분리하여 카테고리별/전체 조회 분기 처리
Repository: 카테고리별 조회 쿼리 추가
src/main/java/eatda/repository/store/StoreRepository.java
findAllByCategoryOrderByCreatedAtDesc 메서드 추가로 카테고리 필터링 지원
StoreCategory Enum: 명칭 변경
src/main/java/eatda/domain/store/StoreCategory.java
CAFE 항목의 표시명 "카페" → "카페/디저트"로 변경
테스트: 컨트롤러 테스트 확장
src/test/java/eatda/controller/store/StoreControllerTest.java
전체/카테고리별 가게 목록 조회 테스트 추가 및 기존 테스트 수정
테스트: 서비스 테스트 확장
src/test/java/eatda/service/store/StoreServiceTest.java
전체/카테고리별 가게 목록 조회 테스트 추가 및 기존 테스트 수정
테스트: 문서화 테스트 갱신
src/test/java/eatda/document/store/StoreDocumentTest.java
API 문서 및 테스트에 category 파라미터 반영, 목킹 및 예외 테스트 수정
테스트: 가게 생성 유틸 개선
src/test/java/eatda/fixture/StoreGenerator.java
카테고리 및 생성일 지정 가능한 generate 오버로드 메서드 추가, 내부 create 메서드 도입

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant StoreController
    participant StoreService
    participant StoreRepository

    Client->>StoreController: GET /stores?size=10&category=CAFE
    StoreController->>StoreService: getStores(10, "CAFE")
    StoreService->>StoreRepository: findAllByCategoryOrderByCreatedAtDesc(CAFE, pageable)
    StoreRepository-->>StoreService: List<Store>
    StoreService-->>StoreController: StoresResponse
    StoreController-->>Client: ResponseEntity<StoresResponse>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
가게 조회 API에 카테고리(category) 필터링 파라미터 추가
(#125)
category가 없을 경우 전체 가게 조회
(#125)
쿼리 파라미터로 'category=한식' 등 문자열로 받기
(#125)
기존 동작(카테고리 미지정 시 전체 조회) 보장
(#125)

Assessment against linked issues: Out-of-scope changes

(해당 PR에서는 모든 변경사항이 이슈 #125의 목적에 부합합니다. 범위를 벗어난 변경사항이 없습니다.)

Possibly related PRs

Suggested labels

feat

Suggested reviewers

  • lvalentine6

Poem

🐇
가게를 찾는 길이 더 넓어졌어요,
카테고리 골라서 쏙쏙 보여줘요!
한식, 카페/디저트, 뭐든지 OK,
테스트도 꼼꼼히 챙겼으니
오늘도 맛집 탐방,
코드와 함께 신나게 출발해요!
🌸

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4eb4fdb and 0dfa9de.

📒 Files selected for processing (8)
  • src/main/java/eatda/controller/store/StoreController.java (1 hunks)
  • src/main/java/eatda/domain/store/StoreCategory.java (1 hunks)
  • src/main/java/eatda/repository/store/StoreRepository.java (2 hunks)
  • src/main/java/eatda/service/store/StoreService.java (2 hunks)
  • src/test/java/eatda/controller/store/StoreControllerTest.java (3 hunks)
  • src/test/java/eatda/document/store/StoreDocumentTest.java (5 hunks)
  • src/test/java/eatda/fixture/StoreGenerator.java (1 hunks)
  • src/test/java/eatda/service/store/StoreServiceTest.java (2 hunks)
🧰 Additional context used
🧠 Learnings (8)
src/main/java/eatda/domain/store/StoreCategory.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

src/main/java/eatda/repository/store/StoreRepository.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

src/main/java/eatda/controller/store/StoreController.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

src/test/java/eatda/service/store/StoreServiceTest.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

src/main/java/eatda/service/store/StoreService.java (2)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/store/CheerService.java:35-46
Timestamp: 2025-07-20T05:38:13.430Z
Learning: CheerService에서 각 컴포넌트(storeSearchFilter, memberRepository, imageService)들이 자신의 책임 범위 내에서 검증을 수행하므로 서비스 레이어에서 추가적인 중복 검증이 불필요함. 각 레이어의 책임 분리가 잘 되어 있는 구조.

src/test/java/eatda/document/store/StoreDocumentTest.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

src/test/java/eatda/fixture/StoreGenerator.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

src/test/java/eatda/controller/store/StoreControllerTest.java (1)

Learnt from: leegwichan
PR: #90
File: src/main/java/eatda/service/story/StoryService.java:93-93
Timestamp: 2025-07-20T03:52:23.831Z
Learning: StoreCategory enum has @Getter annotation with a categoryName field, so getCategoryName() method is automatically generated by Lombok at compile time and won't appear in source code searches.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (25)
src/main/java/eatda/domain/store/StoreCategory.java (1)

15-15: 카테고리 명칭 개선이 적절합니다.

CAFE 카테고리의 표시명을 "카페"에서 "카페/디저트"로 변경한 것은 보다 포괄적이고 명확한 분류를 제공합니다.

src/main/java/eatda/repository/store/StoreRepository.java (2)

4-4: 필요한 import가 추가되었습니다.

StoreCategory 타입을 사용하기 위한 적절한 import입니다.


24-24: Spring Data JPA 네이밍 규칙을 잘 따른 메서드입니다.

메서드명이 기능을 명확히 표현하고 있으며, 기존 메서드와 일관된 패턴을 유지하고 있습니다.

src/main/java/eatda/controller/store/StoreController.java (1)

26-28: 선택적 카테고리 필터링이 올바르게 구현되었습니다.

@RequestParam(required = false) 어노테이션을 사용하여 선택적 파라미터를 적절히 처리하고 있으며, 서비스 레이어로의 파라미터 전달도 정확합니다.

src/test/java/eatda/document/store/StoreDocumentTest.java (5)

25-25: 테스트에 필요한 import가 추가되었습니다.

StoreCategory enum을 사용하기 위한 적절한 import입니다.


104-106: API 문서가 새로운 파라미터를 정확히 반영하고 있습니다.

선택적 category 파라미터에 대한 설명이 명확하며, 사용 가능한 카테고리 목록도 포함되어 있습니다.


122-128: 테스트가 새로운 API 시그니처를 올바르게 반영하고 있습니다.

고정된 값들을 사용하여 테스트의 일관성을 보장하고 있으며, 서비스 모킹도 두 파라미터를 모두 포함하도록 업데이트되었습니다.


138-138: REST 호출에 카테고리 파라미터가 포함되었습니다.

실제 API 사용 패턴을 정확히 반영한 테스트입니다.


147-148: 실패 시나리오 테스트도 새로운 파라미터를 포함하고 있습니다.

성공 케이스와 동일하게 실패 케이스에서도 category 파라미터를 포함하여 테스트 일관성을 유지하고 있습니다.

Also applies to: 158-158

src/main/java/eatda/service/store/StoreService.java (3)

14-14: 필요한 import들이 추가되었습니다.

StoreCategory와 @nullable 어노테이션을 위한 적절한 import입니다.

Also applies to: 22-22


41-46: 메서드 시그니처 변경이 적절합니다.

@nullable 어노테이션을 사용하여 선택적 파라미터를 명확히 표시하고, 비즈니스 로직을 별도 메서드로 분리하여 책임을 잘 나누었습니다.


48-54: 카테고리 필터링 로직이 깔끔하게 구현되었습니다.

null과 빈 문자열 체크를 통해 전체 조회와 카테고리 필터링을 적절히 분기하고 있습니다. StoreCategory.from() 메서드를 사용한 문자열-enum 변환도 올바르며, 잘못된 카테고리 입력 시 BusinessException이 발생하도록 되어 있어 안전합니다.

src/test/java/eatda/controller/store/StoreControllerTest.java (4)

9-9: 새로운 카테고리 필터링 기능을 위한 import 추가

StoreCategory enum을 import하여 테스트에서 카테고리별 가게 생성 및 필터링 테스트를 지원합니다.


47-47: 테스트 메서드명 개선으로 명확성 증대

기존 테스트 메서드명을 "모든_카테고리의_음식점_목록을_최신순으로_조회한다"로 변경하여 카테고리 필터링 없이 모든 가게를 조회하는 테스트임을 명확히 표현했습니다.


50-54: 명시적 카테고리 지정으로 테스트 데이터 품질 향상

가게 생성 시 KOREAN과 OTHER 카테고리를 명시적으로 지정하여 테스트 데이터의 일관성과 예측 가능성을 높였습니다. 다양한 카테고리를 사용하여 필터링 기능을 효과적으로 테스트할 수 있습니다.


76-106: 카테고리별 필터링 기능 테스트 추가

새로운 테스트 메서드가 다음을 검증합니다:

  • CAFE 카테고리로 필터링된 가게만 반환되는지 확인
  • 최신순 정렬이 올바르게 작동하는지 확인
  • category.getCategoryName()을 쿼리 파라미터로 사용하여 API 요청 수행

테스트 로직이 명확하고 PR 목표인 카테고리 필터링 기능을 적절히 검증합니다.

src/test/java/eatda/service/store/StoreServiceTest.java (5)

14-14: 서비스 레이어 테스트를 위한 StoreCategory import

카테고리별 가게 생성 및 필터링 테스트를 위해 StoreCategory enum을 적절히 import했습니다.


63-63: 테스트 메서드명 명확화

"모든_카테고리의_음식점_목록을_최신순으로_조회한다"로 메서드명을 변경하여 카테고리 필터링 없이 전체 가게를 조회하는 테스트임을 명확히 했습니다.


66-70: 다양한 카테고리로 테스트 데이터 구성

KOREAN과 OTHER 카테고리를 명시적으로 지정하여 카테고리 필터링 기능 테스트를 위한 적절한 데이터셋을 구성했습니다.


76-76: null 파라미터로 전체 카테고리 조회 테스트

storeService.getStores(size, null)로 호출하여 카테고리 필터 없이 모든 가게를 조회하는 기능을 테스트합니다. null 처리가 올바르게 구현되었는지 확인하는 중요한 테스트입니다.


85-107: 카테고리별 필터링 서비스 로직 검증

새로운 테스트가 다음을 검증합니다:

  • KOREAN 카테고리로 필터링 시 해당 카테고리 가게만 반환
  • category.getCategoryName()을 파라미터로 전달하여 서비스 메서드 호출
  • 최신순 정렬과 올바른 사이즈 제한 적용

서비스 레이어에서 카테고리 필터링 로직이 정확히 작동하는지 확인하는 핵심 테스트입니다.

src/test/java/eatda/fixture/StoreGenerator.java (4)

29-31: 기존 generate 메서드의 적절한 리팩토링

기존 메서드를 새로운 create 메서드를 활용하도록 리팩토링하여 코드 중복을 제거하고 DEFAULT_CATEGORY를 사용하여 하위 호환성을 유지했습니다.


33-37: 타임스탬프 지원 메서드 추가

DomainUtils.setCreatedAt을 사용하여 생성 시간을 설정할 수 있는 오버로드 메서드를 추가했습니다. 시간 순서 테스트에 필요한 기능을 제공합니다.


39-43: 카테고리와 타임스탬프 모두 지원하는 메서드

카테고리와 생성 시간을 모두 지정할 수 있는 가장 완전한 형태의 generate 메서드입니다. 카테고리별 필터링 테스트에서 시간 순서까지 제어해야 하는 경우에 유용합니다.


45-57: 카테고리 지원하는 private create 메서드

Store 생성 로직을 캡슐화하고 카테고리 파라미터를 추가하여 다양한 generate 메서드들의 공통 로직을 처리합니다. 빌더 패턴을 사용하여 가독성 있게 구현되었습니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/PRODUCT-216

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud
Copy link

Copy link
Member

@lvalentine6 lvalentine6 left a comment

Choose a reason for hiding this comment

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

이번 PR도 고생하셨습니다! 🦖
5대기처럼 변동 사항이 있으면 바로 작업해주시는군요.. 🦅

@leegwichan leegwichan merged commit dd9fa7a into develop Jul 30, 2025
7 checks passed
@leegwichan leegwichan deleted the feat/PRODUCT-216 branch July 30, 2025 21:35
@github-actions
Copy link

🎉 This PR is included in version 1.4.0-develop.35 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 1.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PRODUCT-216] [Feat] '가게 조회 API'에 카테고리 필터링 추가

3 participants