Skip to content

Conversation

@KiSeungMin
Copy link
Member

@KiSeungMin KiSeungMin commented Jul 21, 2025

✔️ 연관 이슈

📝 작업 내용

  • 웨이블존 추천, 검색 응답 필드에 장애 시설 정보를 추가했습니다.

    • 테스트 코드를 통해 잘 반환하는 것을 확인했습니다.
  • JWT 추가로 테스트 코드 api 요청 과정에서 문제가 발생해, 해당 오류를 해결했습니다

  • 지도 기반 검색 기능의 엔드포인트를 /search/maps로 변경했습니다.

    • 향후 추가될 XX동 주변 TOP3 가게 조회 기능과 엔드포인트를 분리하기 위해 이렇게 변경했습니다.
  • ci/cd test하다가 pr 꼬여서 다시 올립니당 ㅎ

Summary by CodeRabbit

  • 신규 기능

    • 시설 정보(경사로, 문턱 없음, 엘리베이터, 테이블 좌석, 장애인 화장실, 층 정보) 제공 필드가 검색 및 추천 결과에 추가되었습니다.
    • 상세 조회 시 사용자 방문 로그가 실제 사용자 ID로 기록됩니다.
  • 버그 수정

    • 검색 API 엔드포인트가 "/maps"로 변경되어 보다 명확하게 접근할 수 있습니다.
  • 테스트

    • 통합 테스트에 JWT 인증 및 다양한 시설 데이터 검증이 추가되어 테스트 신뢰성이 향상되었습니다.
  • 문서화

    • Elasticsearch 매핑에 시설 관련 필드가 추가되어 검색이 더욱 정교해졌습니다.

@KiSeungMin KiSeungMin self-assigned this Jul 21, 2025
@KiSeungMin KiSeungMin added the 💡 feature 기능 구현 및 개발 label Jul 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Walkthrough

웨이블존(장소) 추천 및 검색 기능의 응답에 장애 시설 정보가 포함되도록 전체 도메인, DTO, Elasticsearch 매핑, 테스트 코드가 확장되었습니다. 이에 따라 엔티티, DTO, 매핑, 컨트롤러, 테스트 등 여러 계층에서 facility 관련 필드와 변환 로직이 추가 및 반영되었습니다.

Changes

파일/경로 요약 변경 내용 요약
build.gradle AWS SDK core 및 S3 라이브러리 의존성 추가 (중복 포함)
src/main/java/com/wayble/server/common/entity/BaseEntity.java restore() 메서드 추가 (soft delete 복구용)
src/main/java/com/wayble/server/explore/dto/FacilityResponseDto.java
src/main/java/com/wayble/server/explore/entity/EsWaybleZoneFacility.java
장애 시설 정보를 위한 DTO 및 Elasticsearch 엔티티 클래스 신규 추가
src/main/java/com/wayble/server/explore/dto/recommend/WaybleZoneRecommendResponseDto.java
src/main/java/com/wayble/server/explore/dto/search/WaybleZoneDocumentRegisterDto.java
src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java
추천/검색 응답 DTO에 facility 필드 추가 및 팩토리 메서드 수정
src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java Elasticsearch 문서에 facility 필드 추가 및 팩토리 메서드 수정, 썸네일 이미지 조건부 할당
src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java GET 매핑 경로를 ""에서 "/maps"로 변경
src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java 추천 응답 생성 시 facility 정보 포함
src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java 일부 메서드 접근제어자를 public → private으로 변경
src/main/java/com/wayble/server/user/repository/UserRepository.java JPA 쿼리 관련 import 추가 (기능 변화 없음)
src/main/java/com/wayble/server/wayblezone/controller/WaybleZoneController.java 상세 조회시 SecurityContext에서 userId 추출 및 방문로그에 전달
src/main/resources/elasticsearch/settings/wayble_zone_mappings.json Elasticsearch 매핑에 facility object 필드 및 하위 속성 추가
src/test/java/com/wayble/server/explore/WaybleZoneRecommendApiIntegrationTest.java
src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java
JWT 인증 및 facility 데이터 생성/검증 로직 추가, 테스트 데이터 구조 및 검증 강화

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant Service
    participant Repository
    participant Elasticsearch

    Client->>Controller: GET /explore/maps (with JWT)
    Controller->>Service: findByCondition(...)
    Service->>Repository: search(...)
    Repository->>Elasticsearch: Query with facility fields
    Elasticsearch-->>Repository: Zone documents with facility info
    Repository-->>Service: List<WaybleZoneDocument>
    Service-->>Controller: List<WaybleZoneSearchResponseDto> (facility 포함)
    Controller-->>Client: 응답 (facility 정보 포함)
Loading

Estimated code review effort

4 (~90분)

Possibly related PRs

Suggested labels

🤔 test, ⚙️ chore

Suggested reviewers

  • seung-in-Yoo
  • hyoinYang

Poem

🐇
장애 시설 정보 hop hop 추가!
검색도 추천도 더 똑똑해졌지,
JWT 인증 hop, 필드 검증 skip 안돼~
엘라스틱에도 새 둥지 마련,
토끼는 오늘도 코드 속을 달려!
🏗️✨

✨ 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

🧹 Nitpick comments (3)
src/main/java/com/wayble/server/common/entity/BaseEntity.java (1)

27-29: 방어적 프로그래밍을 위한 검증 로직 추가를 고려해보세요.

현재 구현은 엔티티가 실제로 삭제된 상태인지 확인하지 않고 복원을 수행합니다. 더 안전한 구현을 위해 다음과 같은 개선을 고려해보세요:

 public void restore() {
+    if (this.deletedAt == null) {
+        return; // 이미 복원된 상태이므로 아무것도 하지 않음
+    }
     this.deletedAt = null;
 }

또는 복원 가능 여부를 확인하는 헬퍼 메서드와 함께:

public boolean isDeleted() {
    return this.deletedAt != null;
}

public void restore() {
    if (!isDeleted()) {
        return;
    }
    this.deletedAt = null;
}
src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java (1)

186-194: facility 검증 로직 중복

여러 테스트 메서드에서 동일한 facility 검증 로직이 반복됩니다. 가독성과 유지보수성을 위해 별도의 메서드로 추출하는 것을 고려해보세요.

다음과 같은 헬퍼 메서드를 추가하여 중복을 제거할 수 있습니다:

private void assertFacilityNotNull(FacilityResponseDto facility) {
    assertThat(facility).isNotNull();
    assertThat(facility.hasSlope()).isNotNull();
    assertThat(facility.hasNoDoorStep()).isNotNull();
    assertThat(facility.hasElevator()).isNotNull();
    assertThat(facility.hasTableSeat()).isNotNull();
    assertThat(facility.hasDisabledToilet()).isNotNull();
    assertThat(facility.floorInfo()).isNotNull();
}
src/test/java/com/wayble/server/explore/WaybleZoneRecommendApiIntegrationTest.java (1)

271-277: facility 검증 로직 중복

WaybleZoneSearchApiIntegrationTest와 동일하게 facility 검증 로직이 반복됩니다. 공통 테스트 유틸리티 클래스에 추출하면 두 테스트 클래스에서 재사용할 수 있습니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dd2c179 and 8b70d24.

📒 Files selected for processing (16)
  • build.gradle (1 hunks)
  • src/main/java/com/wayble/server/common/entity/BaseEntity.java (1 hunks)
  • src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java (1 hunks)
  • src/main/java/com/wayble/server/explore/dto/FacilityResponseDto.java (1 hunks)
  • src/main/java/com/wayble/server/explore/dto/recommend/WaybleZoneRecommendResponseDto.java (3 hunks)
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneDocumentRegisterDto.java (2 hunks)
  • src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java (3 hunks)
  • src/main/java/com/wayble/server/explore/entity/EsWaybleZoneFacility.java (1 hunks)
  • src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java (3 hunks)
  • src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java (1 hunks)
  • src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (3 hunks)
  • src/main/java/com/wayble/server/user/repository/UserRepository.java (1 hunks)
  • src/main/java/com/wayble/server/wayblezone/controller/WaybleZoneController.java (2 hunks)
  • src/main/resources/elasticsearch/settings/wayble_zone_mappings.json (1 hunks)
  • src/test/java/com/wayble/server/explore/WaybleZoneRecommendApiIntegrationTest.java (12 hunks)
  • src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java (11 hunks)
🧰 Additional context used
🧠 Learnings (3)
src/main/java/com/wayble/server/user/repository/UserRepository.java (1)

Learnt from: seung-in-Yoo
PR: #37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.318Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.

src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java (1)

Learnt from: seung-in-Yoo
PR: #37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.318Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.

src/test/java/com/wayble/server/explore/WaybleZoneRecommendApiIntegrationTest.java (1)

Learnt from: seung-in-Yoo
PR: #37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.318Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.

🔇 Additional comments (18)
src/main/java/com/wayble/server/common/entity/BaseEntity.java (1)

27-29: soft deletion 복원 기능이 올바르게 구현되었습니다.

restore() 메서드가 soft deletion 패턴에 맞게 deletedAt 필드를 null로 설정하여 엔티티를 복원하는 기능을 정확히 구현했습니다.

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

4-4: 시설 정보 필드 추가 잘 구현됨

WaybleZoneFacility import와 facility 필드 추가가 PR 목표에 맞게 적절히 구현되었습니다. 레코드 패턴을 잘 따르고 있습니다.

Also applies to: 15-15

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

24-24: 엔드포인트 경로 변경 승인

지도 기반 검색 기능을 /maps로 분리하는 변경사항이 PR 목표와 일치합니다. 이는 향후 특정 지역(XX-동) 주변 상위 3개 매장 조회 기능과의 분리를 위한 적절한 변경입니다.

참고: 이는 API 호출자에게 영향을 주는 breaking change입니다.

src/main/java/com/wayble/server/explore/repository/recommend/WaybleZoneQueryRecommendRepository.java (1)

142-142: 시설 정보 추가가 올바르게 구현되었습니다.

FacilityResponseDto.from() 메서드를 사용하여 Elasticsearch 문서의 facility 정보를 응답 DTO로 변환하는 로직이 적절하게 구현되었습니다. 다른 필드들과 동일한 패턴을 따르고 있어 일관성이 유지됩니다.

src/main/resources/elasticsearch/settings/wayble_zone_mappings.json (1)

11-33: 장애 시설 정보 매핑이 적절하게 설계되었습니다.

새로 추가된 facility 객체의 매핑 구조가 잘 설계되었습니다:

  • 접근성 기능들(경사로, 문턱 없음, 엘리베이터 등)에 대해 boolean 타입을 사용한 것이 적절합니다
  • floorInfo에 keyword 타입을 사용하여 정확한 매칭을 지원합니다
  • 객체 구조로 관련 필드들을 논리적으로 그룹화했습니다

이 매핑은 장애 시설 정보에 대한 효율적인 검색과 필터링을 지원할 것입니다.

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

3-3: 적절한 import 추가입니다.

FacilityResponseDto import가 올바르게 추가되었습니다.


27-27: 시설 정보 필드가 올바르게 추가되었습니다.

FacilityResponseDto 타입의 facility 필드가 적절하게 추가되어 추천 응답에 장애 시설 정보를 포함할 수 있게 되었습니다.


48-48: from() 메서드에서 시설 정보 변환이 올바르게 구현되었습니다.

FacilityResponseDto.from()을 사용하여 WaybleZoneDocument의 facility 정보를 적절하게 변환하고 있습니다. null 처리도 FacilityResponseDto.from() 메서드 내에서 처리되므로 안전합니다.

src/main/java/com/wayble/server/explore/dto/search/WaybleZoneSearchResponseDto.java (3)

3-3: 적절한 import 추가입니다.

FacilityResponseDto import가 올바르게 추가되었습니다.


30-30: 시설 정보 필드가 올바르게 추가되었습니다.

검색 응답 DTO에 FacilityResponseDto 타입의 facility 필드가 적절하게 추가되어 검색 결과에 장애 시설 정보를 포함할 수 있게 되었습니다.


43-43: from() 메서드에서 시설 정보 변환이 올바르게 구현되었습니다.

WaybleZoneDocument의 facility 정보를 FacilityResponseDto.from()을 사용하여 적절하게 변환하고 있습니다. 추천 DTO와 동일한 패턴을 따라 일관성이 유지됩니다.

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

1-29: 새로운 FacilityResponseDto가 잘 설계되었습니다.

장애 시설 정보를 담는 DTO가 적절하게 구현되었습니다:

좋은 점:

  • Record 사용으로 불변성과 간결성을 제공합니다
  • Boolean wrapper 타입 사용으로 null 허용이 가능합니다
  • 명확하고 일관된 네이밍 컨벤션을 따릅니다
  • from() 메서드에서 null 체크를 적절히 수행합니다
  • @builder 어노테이션으로 객체 생성의 가독성을 높입니다

구현 세부사항:

  • 접근성 관련 boolean 필드들이 적절하게 정의되었습니다
  • floorInfo는 층별 정보를 저장하는 용도로 String 타입이 적합합니다
  • EsWaybleZoneFacility에서 변환하는 로직이 모든 필드를 올바르게 매핑합니다
src/main/java/com/wayble/server/explore/service/WaybleZoneRecommendService.java (1)

60-60: 적절한 캡슐화를 위한 좋은 변경입니다.

내부에서만 사용되는 메서드들의 접근 제한자를 public에서 private으로 변경한 것은 적절한 정보 은닉 원칙을 따르는 좋은 리팩토링입니다.

Also applies to: 75-75, 91-91

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

48-48: TODO 주석 확인 필요

이미 getMainImageUrl()을 사용하고 있는데 TODO 주석이 남아있습니다. 추가 작업이 필요한지 확인해주세요.

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

1-34: 장애 시설 정보 엔티티가 잘 구현되었습니다.

불변 객체 패턴과 null 안전성을 고려한 좋은 구현입니다. Builder 패턴의 접근 제한과 생성자 보호가 적절히 설정되어 있습니다.

src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java (1)

84-128: 테스트 설정이 포괄적으로 잘 구현되었습니다.

JWT 인증과 facility 데이터가 테스트에 적절히 통합되었으며, 테스트 데이터 생성 로직이 잘 구성되어 있습니다.

src/test/java/com/wayble/server/explore/WaybleZoneRecommendApiIntegrationTest.java (2)

78-78: 테스트 데이터 수 감소는 적절한 최적화입니다.

1000개에서 100개로 줄인 것은 테스트 실행 시간을 단축하면서도 충분한 테스트 커버리지를 유지하는 좋은 결정입니다.


313-313: 파라미터명 변경 확인

count에서 size로 파라미터명이 변경되었습니다. API 문서도 함께 업데이트되었는지 확인해주세요.

Comment on lines +38 to +39
implementation 'com.amazonaws:aws-java-sdk-core:1.12.698'
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.698'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

중복된 AWS SDK 의존성 제거 필요

AWS SDK 의존성이 두 번 선언되어 있습니다 (라인 38-39와 48-49). 중복 선언을 제거해야 합니다.

다음 diff를 적용하여 중복을 제거하세요:

-	implementation 'com.amazonaws:aws-java-sdk-core:1.12.698'
-	implementation 'com.amazonaws:aws-java-sdk-s3:1.12.698'
 	runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
 	runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
 
 	runtimeOnly 'com.mysql:mysql-connector-j'
 	compileOnly 'org.projectlombok:lombok'
 	annotationProcessor 'org.projectlombok:lombok'
 
     //AWS S3
 	implementation 'com.amazonaws:aws-java-sdk-core:1.12.698'
 	implementation 'com.amazonaws:aws-java-sdk-s3:1.12.698'

Also applies to: 48-49

🤖 Prompt for AI Agents
In build.gradle around lines 38-39 and 48-49, the AWS SDK dependencies are
declared twice. Remove the duplicate implementation lines at 48-49 to keep only
one declaration of 'com.amazonaws:aws-java-sdk-core:1.12.698' and
'com.amazonaws:aws-java-sdk-s3:1.12.698' to avoid redundancy.

.zoneName(waybleZone.getZoneName())
.zoneType(waybleZone.getZoneType())
.thumbnailImageUrl("thumbnail image url") // TODO: 이미지 경로 추가
.thumbnailImageUrl(waybleZone.getMainImageUrl() != null ? waybleZone.getMainImageUrl() : null) // TODO: 이미지 경로 추가
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

불필요한 삼항 연산자 사용

현재 로직은 waybleZone.getMainImageUrl() != null ? waybleZone.getMainImageUrl() : null인데, 이는 단순히 waybleZone.getMainImageUrl()과 동일합니다.

다음과 같이 수정하세요:

-.thumbnailImageUrl(waybleZone.getMainImageUrl() != null ? waybleZone.getMainImageUrl() : null)   // TODO: 이미지 경로 추가
+.thumbnailImageUrl(waybleZone.getMainImageUrl())   // TODO: 이미지 경로 추가
📝 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
.thumbnailImageUrl(waybleZone.getMainImageUrl() != null ? waybleZone.getMainImageUrl() : null) // TODO: 이미지 경로 추가
.thumbnailImageUrl(waybleZone.getMainImageUrl()) // TODO: 이미지 경로 추가
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/explore/entity/WaybleZoneDocument.java at
line 48, the ternary operator checking if waybleZone.getMainImageUrl() is null
and returning it or null is redundant. Replace the entire expression with just
waybleZone.getMainImageUrl() to simplify the code without changing its behavior.

Comment on lines +6 to +7
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

사용되지 않는 import 구문일 가능성 확인 필요

@Query@Param annotation을 위한 import가 추가되었지만, 파일에서 실제 커스텀 쿼리 메서드는 보이지 않습니다. 만약 이 import들이 사용되지 않는다면 제거하는 것이 좋습니다.

다음 스크립트로 해당 annotation들이 실제로 사용되는지 확인해주세요:


🏁 Script executed:

#!/bin/bash
# UserRepository에서 @Query와 @Param이 실제로 사용되는지 확인
rg -A 10 "@Query|@Param" src/main/java/com/wayble/server/user/repository/UserRepository.java

Length of output: 94


사용되지 않는 import 제거 필요

UserRepository.java에서 @Query@Param 애노테이션이 실제로 사용되지 않으므로 해당 import 구문을 제거해주세요.

수정 위치:

  • src/main/java/com/wayble/server/user/repository/UserRepository.java
    제거할 라인: 6–7

제안된 diff:

- import org.springframework.data.jpa.repository.Query;
- import org.springframework.data.repository.query.Param;
📝 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
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/user/repository/UserRepository.java at lines
6 to 7, the imports for org.springframework.data.jpa.repository.Query and
org.springframework.data.repository.query.Param are unused. Remove these two
import statements to clean up the code and avoid unnecessary imports.

Comment on lines +61 to +62
Long userId = (Long) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
waybleZoneVisitLogService.saveVisitLog(userId, waybleZoneId);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

JWT에서 사용자 ID 추출 시 안전성 검증 필요

SecurityContextHolder에서 principal을 Long으로 직접 캐스팅하는 것은 ClassCastException을 유발할 수 있습니다. JWT 토큰 검증과 타입 안전성을 보장하는 로직이 필요합니다.

다음과 같이 안전한 구현으로 수정하는 것을 권장합니다:

-        Long userId = (Long) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
-        waybleZoneVisitLogService.saveVisitLog(userId, waybleZoneId);
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+        if (authentication != null && authentication.getPrincipal() instanceof Long userId) {
+            waybleZoneVisitLogService.saveVisitLog(userId, waybleZoneId);
+        } else {
+            // 인증되지 않은 사용자의 경우 로그 처리 방식 결정 필요
+            waybleZoneVisitLogService.saveVisitLog(null, waybleZoneId);
+        }
📝 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
Long userId = (Long) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
waybleZoneVisitLogService.saveVisitLog(userId, waybleZoneId);
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.getPrincipal() instanceof Long userId) {
waybleZoneVisitLogService.saveVisitLog(userId, waybleZoneId);
} else {
// 인증되지 않은 사용자의 경우 로그 처리 방식 결정 필요
waybleZoneVisitLogService.saveVisitLog(null, waybleZoneId);
}
🤖 Prompt for AI Agents
In
src/main/java/com/wayble/server/wayblezone/controller/WaybleZoneController.java
at lines 61-62, directly casting the principal from SecurityContextHolder to
Long risks ClassCastException and lacks JWT validation. Modify the code to
safely extract the user ID by first verifying the authentication object and its
principal type, then retrieving the user ID in a type-safe manner, ensuring JWT
token validation is performed before using the ID.

@KiSeungMin KiSeungMin merged commit 7322921 into develop Jul 21, 2025
5 checks passed
@KiSeungMin KiSeungMin deleted the feature/seungmin-facility branch July 29, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 feature 기능 구현 및 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants