Skip to content

Conversation

@KiSeungMin
Copy link
Member

@KiSeungMin KiSeungMin commented Jul 14, 2025

✔️ 연관 이슈

📝 작업 내용

  • Elastic Search 관련 기능을 모두 담당하는 Explore 패키지를 생성했습니다.

    • 검색과 추천을 별도의 패키지로 구분해 개발하려고 했으나, 공동 엔티티나 로직이 생각보다 많을 것 같아 Explore 패키지로 통합하고, 내부에서 분리하기로 결정했습니다.
    • 다른 작업 사항에는 영향을 끼치지 않았습니다.
  • Repository를 인식할 때 스프링이 JPA, Elastic Search 중 어떤 Repository로 사용하는지 모호하다는 경고 문구를 내뱉고 있어서 이를 해결했습니다.

스크린샷 (선택)

Summary by CodeRabbit

  • 신규 기능

    • 개인화된 Wayble Zone 추천 API가 추가되었습니다.
    • Wayble Zone 방문 로그 관리 및 나이대 분류 기능이 도입되었습니다.
    • Wayble Zone Elasticsearch 기반 검색 및 추천 관련 서비스, 레포지토리, DTO, 예외가 추가되었습니다.
  • 버그 수정

    • 검색 및 추천 관련 API 엔드포인트와 패키지 구조가 일관성 있게 정비되었습니다.
  • 리팩터

    • 기존 search 패키지의 클래스, DTO, 레포지토리 등이 explore 패키지로 이동 및 통합되었습니다.
    • 검색 반경 기본값이 100km에서 50km로 조정되었습니다.
  • 테스트

    • 통합 테스트의 검색 데이터 볼륨 및 엔드포인트, 반경, 인코딩 처리 등이 최신 구조에 맞게 수정되었습니다.

@KiSeungMin KiSeungMin self-assigned this Jul 14, 2025
@KiSeungMin KiSeungMin added ⚙️ chore 패키지 매니저 및 기타 수정 🔧 refactor 코드 리팩토링 labels Jul 14, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 14, 2025

"""

Walkthrough

Elasticsearch 관련 코드가 기존 search 패키지에서 explore 패키지로 대규모 이동 및 리팩토링되었습니다. 새로운 추천 기능이 추가되고, Spring Boot의 Elasticsearch 리포지토리 설정이 변경되었습니다. Docker Compose 네트워크 설정도 명확하게 조정되었습니다.

Changes

파일/경로 그룹 변경 요약
docker-els.yml es-network에 external: false, attachable: true 명시 추가
src/main/java/com/wayble/server/ServerApplication.java ReactiveElasticsearchRepositoriesAutoConfiguration 제외, @EnableElasticsearchRepositories 명시
src/main/java/com/wayble/server/common/config/ElasticsearchConfig.java @EnableElasticsearchRepositories 어노테이션 제거
src/main/java/com/wayble/server/common/config/SwaggerConfig.java 패키지명 변경
src/main/java/com/wayble/server/explore/controller/WaybleZoneRecommendController.java WaybleZoneRecommendController 신규 생성, 추천 API 엔드포인트 추가
src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java SearchController → WaybleZoneSearchController로 명칭 및 패키지 변경, 경로 수정
src/main/java/com/wayble/server/explore/dto/recommend/WaybleZoneRecommendResponseDto.java WaybleZoneRecommendResponseDto 레코드 신설
src/main/java/com/wayble/server/explore/dto/search/... (4개 파일) search.dto → explore.dto.search로 패키지 변경
src/main/java/com/wayble/server/explore/entity/AgeGroup.java AgeGroup enum 신설, 생년월일로 연령대 반환 메서드 추가
src/main/java/com/wayble/server/explore/entity/EsAddress.java search.entity → explore.entity로 패키지 변경
src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java search.entity → explore.entity로 패키지 변경 및 dto import 수정, id → zoneId 필드명 변경
src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java WaybleZoneVisitLogDocument 신규 생성, User 및 zoneId 기반 팩토리 메서드 포함
src/main/java/com/wayble/server/explore/exception/RecommendErrorCase.java RecommendErrorCase enum 신설, INVALID_USER 에러케이스 추가
src/main/java/com/wayble/server/explore/exception/SearchErrorCase.java search.exception → explore.exception로 패키지 변경
src/main/java/com/wayble/server/explore/repository/WaybleZoneDocumentRepository.java WaybleZoneDocumentRepository 신설, 기본 CRUD 메서드 정의
src/main/java/com/wayble/server/explore/repository/WaybleZoneVisitLogDocumentRepository.java WaybleZoneVisitLogDocumentRepository 신설, 기본 CRUD 상속
src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java WaybleZoneQueryRecommendRepository 신설, 추천 쿼리용 메서드 추가(구현 없음)
src/main/java/com/wayble/server/explore/repository/search/WaybleZoneQuerySearchRepository.java WaybleZoneSearchRepositoryImpl → WaybleZoneQuerySearchRepository로 변경, 반경 100→50km로 수정
src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java WaybleZoneRecommendService 신설, 개인화 추천 서비스 구현
src/main/java/com/wayble/server/explore/service/WaybleZoneSearchService.java WaybleZoneSearchService 신설, 검색 서비스 및 CRUD 제공
src/main/java/com/wayble/server/search/repository/WaybleZoneSearchRepository.java 삭제: WaybleZoneSearchRepository 인터페이스
src/main/java/com/wayble/server/search/repository/WaybleZoneSearchRepositoryCustom.java 삭제: WaybleZoneSearchRepositoryCustom 인터페이스
src/main/java/com/wayble/server/search/service/SearchService.java 삭제: SearchService 클래스
src/test/java/com/wayble/server/search/WaybleZoneSearchApiIntegrationTest.java explore 패키지로 import/사용처 변경, 데이터 1000→5000건, 반경 150→50, baseUrl 상수화, 응답 인코딩 명시 등

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WaybleZoneRecommendController
    participant WaybleZoneRecommendService
    participant UserRepository
    participant WaybleZoneQueryRecommendRepository

    User->>WaybleZoneRecommendController: GET /api/v1/wayble-zones/recommend/{userId}
    WaybleZoneRecommendController->>WaybleZoneRecommendService: getWaybleZonePersonalRecommend(userId)
    WaybleZoneRecommendService->>UserRepository: findById(userId)
    alt User exists
        WaybleZoneRecommendService->>WaybleZoneQueryRecommendRepository: searchPersonalWaybleZone(user)
        WaybleZoneQueryRecommendRepository-->>WaybleZoneRecommendService: WaybleZoneRecommendResponseDto
        WaybleZoneRecommendService-->>WaybleZoneRecommendController: WaybleZoneRecommendResponseDto
        WaybleZoneRecommendController-->>User: CommonResponse(success)
    else User not found
        WaybleZoneRecommendService-->>WaybleZoneRecommendController: throw ApplicationException(INVALID_USER)
        WaybleZoneRecommendController-->>User: Error Response
    end
Loading

Possibly related PRs

  • Wayble-Project/wayble-spring#28: 기존 search 패키지에 Elasticsearch 맵 검색 기능을 최초 도입한 PR로, 본 PR의 explore 패키지 리팩토링 및 확장과 직접적으로 연결됨.

Suggested reviewers

  • seung-in-Yoo
  • hyoinYang

Poem

🐇
패키지가 이사했어요, search에서 explore로,
추천과 검색, 모두 새 집에서 똑똑!
연령대 enum도, 방문 로그도 추가,
토끼는 깡총깡총, 리팩토링을 축하!
Elasticsearch야, 이제 더 깔끔하게 뛰어놀자!

"""


📜 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 b454e2e and 8684288.

📒 Files selected for processing (1)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java
✨ Finishing Touches
  • 📝 Generate Docstrings

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

@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.

Actionable comments posted: 4

🔭 Outside diff range comments (1)
src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java (1)

38-39: 잠재적 NullPointerException

waybleZoneDocument.getAddress().getLocation() 호출 시 address 또는 location 이 null 이면 NPE가 발생합니다. 방어 코드 추가를 권장합니다.

-                .latitude(waybleZoneDocument.getAddress().getLocation().getLat())
-                .longitude(waybleZoneDocument.getAddress().getLocation().getLon())
+                .latitude(
+                        waybleZoneDocument.getAddress() != null && waybleZoneDocument.getAddress().getLocation() != null
+                                ? waybleZoneDocument.getAddress().getLocation().getLat()
+                                : null)
+                .longitude(
+                        waybleZoneDocument.getAddress() != null && waybleZoneDocument.getAddress().getLocation() != null
+                                ? waybleZoneDocument.getAddress().getLocation().getLon()
+                                : null)
🧹 Nitpick comments (9)
src/main/java/com/wayble/server/explore/dto/search/WaybleZoneDocumentRegisterDto.java (1)

11-12: 필드 명명 규칙 일관성 확보 필요

waybleZoneType 필드명은 다른 DTO(WaybleZoneSearchResponseDtozoneType)와 달라 가독성을 저하시킵니다. 동일 도메인 개념은 통일된 네이밍을 유지해 주세요.

-        WaybleZoneType waybleZoneType,
+        WaybleZoneType zoneType,
src/main/java/com/wayble/server/explore/exception/SearchErrorCase.java (1)

11-12: HTTP 상태 코드 재검토 권장

SEARCH_EXCEPTION 이 400(Bad Request)으로 매핑되어 있습니다. 내부 처리 중 발생한 예외라면 500 계열이 더 적절할 수 있으니 팀 규칙에 따라 재검토 바랍니다.

src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java (1)

15-15: indexName 상수화 고려

문자열 "wayble_zone" 을 클래스 내 상수로 추출하면 인덱스명 변경 시 실수를 줄일 수 있습니다.

src/main/java/com/wayble/server/explore/dto/recommend/WaybleZoneRecommendResponseDto.java (1)

3-7: 추천 응답 스키마 확장 검토

추천 API 결과가 username 하나만 제공되면 클라이언트에서 영역 정보를 얻기 위해 추가 호출이 필요합니다. 최소한 zone ID, 이름 정도를 포함하도록 확장 여부를 논의해 보시길 권장합니다.

src/main/java/com/wayble/server/explore/entity/AgeGroup.java (1)

17-42: 경계값 및 음수‧미래 생년월일 처리 고려

Period.between(birthDate, LocalDate.now()).getYears() 결과가 음수(미래 날짜)거나 0~9세인 경우 모두 OTHERS로 분류됩니다.
비즈니스 요구사항에 따라

  1. 0~9세를 별도 그룹으로 둘지,
  2. 미래 생년월일 입력 시 예외를 던질지
    검토가 필요합니다.
    현행 로직이 의도된 것이라면 주석으로 명시해 두는 편이 유지보수에 도움이 됩니다.
src/main/java/com/wayble/server/explore/repository/WaybleZoneDocumentRepository.java (1)

9-12: 중복 메서드 정의 제거 권장

ElasticsearchRepository가 이미 findById, findAll을 제공하므로 재정의 없이도 동일 시그니처를 사용할 수 있습니다.
불필요한 선언을 제거하면 코드가 간결해지고 인터페이스 변경 시 리스크를 줄일 수 있습니다.

-    Optional<WaybleZoneDocument> findById(Long waybleZoneId);
-    List<WaybleZoneDocument> findAll();
src/test/java/com/wayble/server/search/WaybleZoneSearchApiIntegrationTest.java (1)

65-65: 테스트 데이터 규모 증가를 확인하세요.

테스트 데이터가 1000개에서 5000개로 증가했습니다. 이는 테스트 실행 시간과 리소스 사용량을 증가시킬 수 있습니다.

테스트 환경에서 성능 문제가 발생할 경우 데이터 규모를 줄이거나 테스트를 분리하는 것을 고려해보세요.

src/main/java/com/wayble/server/explore/controller/WaybleZoneRecommendController.java (1)

21-26: 경로 변수 유효성 검사 추가 권장

현재 @PathVariable("userId") 매개변수에 대한 유효성 검사가 없습니다. 음수나 0과 같은 유효하지 않은 값이 전달될 수 있습니다.

다음과 같이 유효성 검사를 추가하는 것을 고려해보세요:

@GetMapping("/{userId}")
public CommonResponse<WaybleZoneRecommendResponseDto> getWaybleZonePersonalRecommend(
-       @PathVariable("userId") Long userId) {
+       @PathVariable("userId") @Min(1) Long userId) {

@Min(1) 어노테이션을 사용하려면 javax.validation.constraints.Min 임포트가 필요합니다.

src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (1)

16-16: 리포지토리 필드명 일관성 검토

필드명이 waybleZoneRecommendRepository인데 실제 타입은 WaybleZoneQueryRecommendRepository입니다. 의미 전달을 위해 waybleZoneQueryRecommendRepository로 명명하는 것이 더 명확할 수 있습니다.

필드명을 다음과 같이 변경하는 것을 고려해보세요:

-private final WaybleZoneQueryRecommendRepository waybleZoneRecommendRepository;
+private final WaybleZoneQueryRecommendRepository waybleZoneQueryRecommendRepository;

그리고 사용 부분도 함께 변경:

-return waybleZoneRecommendRepository.searchPersonalWaybleZone(user);
+return waybleZoneQueryRecommendRepository.searchPersonalWaybleZone(user);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b3f39a and f4b0d2b.

📒 Files selected for processing (27)
  • docker-els.yml (1 hunks)
  • src/main/java/com/wayble/server/ServerApplication.java (1 hunks)
  • src/main/java/com/wayble/server/common/config/ElasticsearchConfig.java (0 hunks)
  • src/main/java/com/wayble/server/common/config/SwaggerConfig.java (1 hunks)
  • src/main/java/com/wayble/server/explore/controller/WaybleZoneRecommendController.java (1 hunks)
  • src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java (2 hunks)
  • src/main/java/com/wayble/server/explore/dto/recommend/WaybleZoneRecommendResponseDto.java (1 hunks)
  • src/main/java/com/wayble/server/explore/dto/search/SearchSliceDto.java (1 hunks)
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneDocumentRegisterDto.java (1 hunks)
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchConditionDto.java (1 hunks)
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java (1 hunks)
  • src/main/java/com/wayble/server/explore/entity/AgeGroup.java (1 hunks)
  • src/main/java/com/wayble/server/explore/entity/EsAddress.java (1 hunks)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java (1 hunks)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1 hunks)
  • src/main/java/com/wayble/server/explore/exception/RecommendErrorCase.java (1 hunks)
  • src/main/java/com/wayble/server/explore/exception/SearchErrorCase.java (1 hunks)
  • src/main/java/com/wayble/server/explore/repository/WaybleZoneDocumentRepository.java (1 hunks)
  • src/main/java/com/wayble/server/explore/repository/WaybleZoneVisitLogDocumentRepository.java (1 hunks)
  • src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java (1 hunks)
  • src/main/java/com/wayble/server/explore/repository/search/WaybleZoneQuerySearchRepository.java (2 hunks)
  • src/main/java/com/wayble/server/explore/service/SearchService.java (1 hunks)
  • src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (1 hunks)
  • src/main/java/com/wayble/server/search/repository/WaybleZoneSearchRepository.java (0 hunks)
  • src/main/java/com/wayble/server/search/repository/WaybleZoneSearchRepositoryCustom.java (0 hunks)
  • src/main/java/com/wayble/server/search/service/SearchService.java (0 hunks)
  • src/test/java/com/wayble/server/search/WaybleZoneSearchApiIntegrationTest.java (14 hunks)
💤 Files with no reviewable changes (4)
  • src/main/java/com/wayble/server/common/config/ElasticsearchConfig.java
  • src/main/java/com/wayble/server/search/repository/WaybleZoneSearchRepositoryCustom.java
  • src/main/java/com/wayble/server/search/repository/WaybleZoneSearchRepository.java
  • src/main/java/com/wayble/server/search/service/SearchService.java
🧰 Additional context used
🧠 Learnings (4)
src/main/java/com/wayble/server/explore/dto/search/SearchSliceDto.java (1)
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
src/main/java/com/wayble/server/explore/entity/EsAddress.java (1)
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java (1)
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java (1)
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
🧬 Code Graph Analysis (4)
src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java (1)
src/main/java/com/wayble/server/explore/repository/search/WaybleZoneQuerySearchRepository.java (1)
  • Repository (23-123)
src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (1)
src/main/java/com/wayble/server/explore/service/SearchService.java (1)
  • Service (17-48)
src/main/java/com/wayble/server/explore/controller/WaybleZoneRecommendController.java (1)
src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java (1)
  • RestController (16-43)
src/main/java/com/wayble/server/explore/service/SearchService.java (1)
src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (1)
  • Service (12-26)
🔇 Additional comments (26)
docker-els.yml (1)

24-25: external: false는 기본값이라 중복 설정입니다. 네트워크 공유 여부를 재확인해 주세요.

external: false를 명시하면 compose 간 네트워크 재사용(예: 애플리케이션 쪽 docker-compose.yml에서 같은 이름의 네트워크를 external: true로 선언) 시 충돌이 발생할 수 있습니다. 실제로 다른 compose 파일에서 es-network를 외부 네트워크로 참조하고 있지는 않은지 점검해 주세요. 필요 없다면 external 키는 제거해도 무방합니다.
attachable: true 설정 자체는 컨테이너 간 동적 연결이 필요한 경우 유용하니 유지해도 좋습니다.

src/main/java/com/wayble/server/common/config/SwaggerConfig.java (1)

1-1: 패키지 이동 문제 없음 – 빈 스캔 범위 내에 유지됩니다.

루트 패키지가 com.wayble.server이므로 common.config 하위로 옮겨도 Spring Component-scan 대상에 포함됩니다. 별도 설정 변경 없으면 정상 동작합니다.
변경된 FQN을 참조하는 코드가 없는지만 한 번 grep 으로 확인해 두면 좋겠습니다.

src/main/java/com/wayble/server/explore/entity/EsAddress.java (1)

1-1: 패키지 이동에 따른 import 갱신 여부 확인 필요

도메인 코드에서 com.wayble.server.search.entity.EsAddress를 직접 import 하던 부분이 남아 있으면 컴파일 에러가 발생합니다. 전역 검색으로 사용처가 모두 explore.entity로 변경됐는지 확인해 주세요.

src/main/java/com/wayble/server/explore/dto/search/SearchSliceDto.java (1)

1-1: DTO 패키지 변경 확인 완료

패키지 이동만 이뤄졌으며 제네릭 레코드 구조는 그대로입니다. 사용처 import 업데이트만 확인해 주세요.

src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchConditionDto.java (1)

1-1: 패키지 이동만 수행 – 제약 애너테이션 유지 확인

기존 유효성 제약 애너테이션이 그대로 유지되어 로직 영향은 없습니다. 마찬가지로 import 경로만 일관성 있게 업데이트됐는지 점검 부탁드립니다.

src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java (1)

44-45: TODO 항목 처리 및 기본 이미지 경로 상수화

"thumbnail image url" 하드코딩은 추후 잊혀질 위험이 있습니다. 설정 값 또는 상수로 분리하고 TODO 제거해 주세요.

src/main/java/com/wayble/server/explore/exception/RecommendErrorCase.java (1)

7-16: 구현 일관성 확인 완료

필드, 생성자, Lombok @Getter 적용이 올바르게 설정되어 있어 ErrorCase 규약을 충족합니다.
특이사항 없습니다.

src/main/java/com/wayble/server/explore/repository/search/WaybleZoneQuerySearchRepository.java (3)

1-1: 패키지 구조 변경이 잘 적용되었습니다.

search 패키지에서 explore 패키지로의 이동이 올바르게 처리되었습니다.


25-122: Elasticsearch 쿼리 구현이 올바릅니다.

새로운 Elasticsearch 클라이언트 API를 사용한 쿼리 구현이 잘 되어 있습니다. 지역 검색, 텍스트 검색, 정렬 등의 로직이 올바르게 구현되었습니다.


35-35: 기본 검색 반경(50.0km) 변경이 코드와 테스트에 일관되게 적용됨 확인

  • WaybleZoneQuerySearchRepository.java(35줄)에서 기본값이 50.0km로 설정되어 있습니다.
  • WaybleZoneSearchApiIntegrationTest.java 에서도 RADIUS = 50.0을 사용해 모든 테스트가 50.0km 기준으로 동작합니다.
  • WaybleZoneSearchConditionDto의 radiusKm 필드 사용 역시 일관되며, 100.0km 하드코딩은 더 이상 존재하지 않습니다.

위 사항으로 기본 검색 반경 변경이 의도대로 일관성 있게 적용된 것을 확인했습니다.

src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java (3)

1-8: 패키지 구조 변경 및 임포트 업데이트가 올바릅니다.

explore 패키지로의 이동과 관련 DTO, 서비스 임포트가 올바르게 업데이트되었습니다.


19-20: API 경로 개선이 잘 되었습니다.

/search에서 /api/v1/wayble-zones/search로의 변경이 RESTful API 설계 원칙에 더 부합합니다. 버전 관리와 리소스 구조화가 잘 되어 있습니다.


20-20: 컨트롤러 클래스명 변경이 적절합니다.

SearchController에서 WaybleZoneSearchController로의 변경이 클래스의 책임을 더 명확하게 나타냅니다.

src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (2)

28-35: 정적 팩토리 메서드 구현이 우수합니다.

fromEntity 메서드를 통해 User 엔티티로부터 방문 로그 문서를 생성하는 로직이 잘 구현되어 있습니다. 빌더 패턴 사용과 AgeGroup 계산이 적절합니다.


14-14: Elasticsearch 문서 구성이 올바릅니다.

인덱스 이름 wayble_zone_visit_log가 적절하며, 문서 구조가 잘 정의되어 있습니다.

src/test/java/com/wayble/server/search/WaybleZoneSearchApiIntegrationTest.java (3)

7-10: 패키지 구조 변경이 테스트에서 올바르게 반영되었습니다.

explore 패키지로의 이동이 임포트 문에서 올바르게 처리되었습니다.


46-48: 검색 반경과 API URL 업데이트가 일관적입니다.

검색 반경이 50.0km로 변경되고 새로운 API 경로가 적용되어 repository 변경사항과 일치합니다.


20-20: UTF-8 인코딩 명시가 좋은 개선입니다.

응답 문자열을 읽을 때 UTF-8 인코딩을 명시적으로 지정한 것이 한글 처리에 도움이 됩니다.

Also applies to: 125-125, 176-176, 229-229, 284-284

src/main/java/com/wayble/server/ServerApplication.java (3)

5-6: 필요한 임포트가 올바르게 추가되었습니다.

Elasticsearch 리포지토리 구성을 위한 임포트가 적절하게 추가되었습니다.


9-11: Reactive Elasticsearch 자동 구성 제외가 적절합니다.

ReactiveElasticsearchRepositoriesAutoConfiguration을 제외하여 Spring이 JPA와 Elasticsearch 리포지토리를 구분할 수 있도록 했습니다.


13-13: Elasticsearch 리포지토리 구성이 명확합니다.

explore.repository 패키지에 대해 명시적으로 Elasticsearch 리포지토리를 활성화하여 PR 목표에서 언급된 경고 문제를 해결했습니다.

src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (1)

20-25: 서비스 로직 구현이 적절함

사용자 유효성 검사와 예외 처리가 적절하게 구현되어 있습니다. UserRepository를 통한 사용자 조회 후 ApplicationException을 던지는 패턴이 프로젝트의 다른 서비스와 일관성을 보입니다.

src/main/java/com/wayble/server/explore/service/SearchService.java (4)

17-19: 서비스 구조가 적절함

@Service@RequiredArgsConstructor를 사용한 의존성 주입 패턴이 Spring Boot 모범 사례에 따라 적절히 구현되었습니다.


29-32: 적절한 예외 처리 구현

Optional.orElseThrow()를 사용한 예외 처리가 적절하며, 커스텀 예외 ApplicationExceptionSearchErrorCase.NO_SUCH_DOCUMENT를 사용하여 일관성 있는 에러 핸들링을 보여줍니다.


34-40: 엔티티와 DTO 변환 메서드 활용

WaybleZoneDocument.fromEntity()WaybleZoneDocument.fromDto() 정적 팩토리 메서드를 활용하여 깔끔한 변환 로직을 구현했습니다. 이는 좋은 설계 패턴입니다.


42-47: 검색 메서드 구현 확인

검색 조건에 따른 페이지네이션 검색 메서드가 적절히 구현되었습니다. Slice<T>를 사용하여 페이지네이션을 처리하는 것이 Spring Data의 모범 사례입니다.

Comment on lines +13 to +17
private final ElasticsearchOperations operations;

public WaybleZoneRecommendResponseDto searchPersonalWaybleZone(User user) {
return null;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

미구현 메서드가 null을 반환하여 NPE 위험이 있습니다

searchPersonalWaybleZone가 항상 null을 반환하면 서비스·컨트롤러 계층에서 바로 NullPointerException이 발생합니다.
최소한 TODO 주석과 함께 UnsupportedOperationException을 던지거나, 빈 WaybleZoneRecommendResponseDto를 반환하도록 수정하세요.

-    public WaybleZoneRecommendResponseDto searchPersonalWaybleZone(User user) {
-        return null;
-    }
+    public WaybleZoneRecommendResponseDto searchPersonalWaybleZone(User user) {
+        // TODO: Elasticsearch 쿼리 구현
+        throw new UnsupportedOperationException("검색 로직이 아직 구현되지 않았습니다.");
+    }
📝 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
private final ElasticsearchOperations operations;
public WaybleZoneRecommendResponseDto searchPersonalWaybleZone(User user) {
return null;
}
private final ElasticsearchOperations operations;
public WaybleZoneRecommendResponseDto searchPersonalWaybleZone(User user) {
// TODO: Elasticsearch 쿼리 구현
throw new UnsupportedOperationException("검색 로직이 아직 구현되지 않았습니다.");
}
🤖 Prompt for AI Agents
In
src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java
around lines 13 to 17, the method searchPersonalWaybleZone currently returns
null, which risks causing NullPointerExceptions in higher layers. To fix this,
either throw an UnsupportedOperationException with a TODO comment indicating the
method is not yet implemented, or return an empty instance of
WaybleZoneRecommendResponseDto to avoid null returns.


private Gender gender;

private AgeGroup ageGroup;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

AgeGroup 임포트가 누락되었습니다.

AgeGroup 타입이 사용되고 있지만 임포트 문이 누락되었습니다.

다음 임포트를 추가하세요:

+import com.wayble.server.user.entity.AgeGroup;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java
at line 26, the AgeGroup type is used but its import statement is missing. Add
the appropriate import statement for AgeGroup at the top of the file to resolve
the missing import issue.

Copy link

@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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/main/java/com/wayble/server/explore/service/WaybleZoneSearchService.java (2)

25-28: ID로 문서 조회 시 입력 검증을 추가하는 것을 고려해보세요.

현재 구현은 기본적인 예외 처리를 포함하고 있지만, null 또는 음수 ID에 대한 사전 검증을 추가하면 더 안정적인 코드가 될 수 있습니다.

 public WaybleZoneDocument getWaybleZoneDocumentById(Long id) {
+    if (id == null || id <= 0) {
+        throw new ApplicationException(SearchErrorCase.INVALID_DOCUMENT_ID);
+    }
     return waybleZoneDocumentRepository.findById(id)
             .orElseThrow(() -> new ApplicationException(SearchErrorCase.NO_SUCH_DOCUMENT));
 }

38-43: 검색 메서드에서 입력 검증을 추가하는 것을 고려해보세요.

현재 구현은 적절하지만, null 체크나 조건 검증을 추가하면 더 안정적인 서비스가 될 수 있습니다.

 public Slice<WaybleZoneSearchResponseDto> searchWaybleZonesByCondition(
         WaybleZoneSearchConditionDto condition,
         Pageable pageable)
 {
+    if (condition == null) {
+        throw new ApplicationException(SearchErrorCase.INVALID_SEARCH_CONDITION);
+    }
+    if (pageable == null) {
+        throw new ApplicationException(SearchErrorCase.INVALID_PAGEABLE);
+    }
     return waybleZoneQuerySearchRepository.searchWaybleZonesByCondition(condition, pageable);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0dbab7 and d7f15ab.

📒 Files selected for processing (2)
  • src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java (4 hunks)
  • src/main/java/com/wayble/server/explore/service/WaybleZoneSearchService.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java
🔇 Additional comments (4)
src/main/java/com/wayble/server/explore/service/WaybleZoneSearchService.java (4)

1-16: 패키지 구조 및 import 문이 적절합니다.

새로운 explore 패키지 구조로의 리팩토링이 잘 반영되어 있고, 필요한 의존성들이 적절히 import되어 있습니다.


17-24: 서비스 클래스 구조가 Spring 모범 사례를 따르고 있습니다.

@Service 어노테이션과 @RequiredArgsConstructor를 사용한 생성자 주입 방식이 적절하게 구현되어 있습니다.


30-32: 엔티티에서 문서 저장 메서드가 간결하고 적절합니다.

WaybleZoneDocument.fromEntity() 팩토리 메서드를 사용한 변환이 깔끔하게 구현되어 있습니다.


34-36: DTO에서 문서 저장 메서드가 간결하고 적절합니다.

WaybleZoneDocument.fromDto() 팩토리 메서드를 사용한 변환이 깔끔하게 구현되어 있습니다.

Copy link

@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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1)

4-5: AgeGroup 임포트가 누락되었습니다.

AgeGroup 타입이 30번과 37번 라인에서 사용되고 있지만 임포트 문이 누락되었습니다.

다음 임포트를 추가하세요:

 import com.wayble.server.user.entity.Gender;
 import com.wayble.server.user.entity.User;
+import com.wayble.server.user.entity.AgeGroup;
🧹 Nitpick comments (1)
src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1)

34-34: UUID 생성 방식을 개선해보세요.

현재 UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE 방식은 UUID의 절반만 사용하므로 충돌 가능성이 높아집니다. 더 안전한 ID 생성 방식을 고려해보세요.

다음 대안들을 고려해보세요:

대안 1: 전체 UUID 사용

-.logId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE)
+.logId(UUID.randomUUID().toString().hashCode() & Long.MAX_VALUE)

대안 2: 타임스탬프 기반 ID

-.logId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE)
+.logId(System.currentTimeMillis())

대안 3: Elasticsearch 자동 ID 생성 사용

-.logId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE)
+.logId(null) // Elasticsearch가 자동으로 ID 생성
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7f15ab and b454e2e.

📒 Files selected for processing (5)
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java (2 hunks)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java (4 hunks)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1 hunks)
  • src/main/java/com/wayble/server/explore/repository/WaybleZoneVisitLogDocumentRepository.java (1 hunks)
  • src/test/java/com/wayble/server/search/WaybleZoneSearchApiIntegrationTest.java (13 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/java/com/wayble/server/explore/repository/WaybleZoneVisitLogDocumentRepository.java
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java
  • src/test/java/com/wayble/server/search/WaybleZoneSearchApiIntegrationTest.java
🧰 Additional context used
🧠 Learnings (1)
src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1)
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
🔇 Additional comments (1)
src/main/java/com/wayble/server/explore/entity/WaybleZoneVisitLogDocument.java (1)

12-17: Lombok 어노테이션 사용이 적절합니다.

코드 생성을 위한 Lombok 어노테이션들이 잘 구성되어 있고, Elasticsearch 문서 엔티티에 적합한 구조입니다.

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

Labels

⚙️ chore 패키지 매니저 및 기타 수정 🔧 refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants