Skip to content

[feat] 웨이블존 리뷰 목록 조회 API 구현 #26

Merged
KiSeungMin merged 14 commits into
developfrom
feature/seungin
Jul 10, 2025
Merged

[feat] 웨이블존 리뷰 목록 조회 API 구현 #26
KiSeungMin merged 14 commits into
developfrom
feature/seungin

Conversation

@seung-in-Yoo

@seung-in-Yoo seung-in-Yoo commented Jul 9, 2025

Copy link
Copy Markdown
Member

#️⃣ 연관된 이슈

#24

📝 작업 내용

  • 웨이블존 리뷰 목록 조회 API 구현 (GET /api/v1/wayble-zones/{waybleZoneId}/reviews?sort=latest|rating)
  • 리뷰 정렬 기능
  • 리뷰 응답 DTO (ReviewResponseDto) 구현
  • WaybleZone 엔티티에 리뷰 수(reviewCount)와 평균 평점(rating) 필드 추가
  • WaybleZoneFacility 엔티티: 웨이블존의 편의 시설 정보
  • WaybleZoneOperatingHour 엔티티: 요일별 운영 시간 정보
  • WaybleZoneErrorCase의 WAYBLE_ZONE_NOT_FOUND HTTP 상태 코드를 404로 수정

📸 스크린샷 (선택)

  • 응답성공
    리뷰목록조회api성공

  • 응답실패
    화면 캡처 2025-07-10 033242

💬 리뷰 요구사항(선택)

WaybleZoneFacility 엔티티를 WaybleZoneFacilityMapping으로 하여 매핑 테이블 방식으로 구현하려고 했지만,
WaybleZoneFacility 자체가 여러 boolean 필드(경사로, 문턱 없음, 엘리베이터 등) 기반의 구조이기 때문에
facility_id를 FK로 매핑해도 boolean 필드 기반 구조와 충돌 가능성이 있어 해당 방식을 채택하지 않았습니다.

=> 따라서 웨이블존 편의 시설 정보는 단일 엔티티로 Boolean 필드로 구성하였고, 포함한 필드(hasSlope, hasNoDoorStep, hasElevator, hasTableSeat, hasDisabledToilet)는 현재 피그마 UI를 기준으로 설계하였고, 만약 해당 정보가 바뀐다면 나중에 필드 수정이 필요할 것 같습니다.

Summary by CodeRabbit

  • 신규 기능

    • 웨이블존별 리뷰 목록 조회 기능이 추가되었습니다. 최신순 및 평점순 정렬이 가능합니다.
    • 사용자 저장 장소 및 웨이블존과의 매핑, 운영 시간, 시설 정보 등 다양한 엔티티가 추가되어 웨이블존의 상세 정보를 더 풍부하게 확인할 수 있습니다.
  • 개선사항

    • 리뷰 응답 데이터에 리뷰 ID, 작성자 닉네임, 평점, 내용, 방문일, 좋아요 수, 이미지 목록 등 상세 정보가 포함됩니다.
    • 웨이블존 정보에 평균 평점, 리뷰 수, 운영 시간, 시설 정보, 사용자 장소 매핑 등이 추가되었습니다.
  • 버그 수정

    • 존재하지 않는 웨이블존 조회 시 반환되는 오류 코드가 404로 변경되고, 안내 메시지가 더 명확해졌습니다.

@seung-in-Yoo seung-in-Yoo self-assigned this Jul 9, 2025
@seung-in-Yoo seung-in-Yoo added 💡 feature 기능 구현 및 개발 🔧 refactor 코드 리팩토링 labels Jul 9, 2025
@coderabbitai

coderabbitai Bot commented Jul 9, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@seung-in-Yoo has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 38baa09 and de1620e.

📒 Files selected for processing (1)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1 hunks)

"""

Walkthrough

리뷰 조회 기능이 추가되어, 특정 웨이블존의 리뷰 목록을 정렬 기준(최신순 또는 평점순)에 따라 조회할 수 있는 GET 엔드포인트가 신설되었습니다. 또한, 리뷰 응답 DTO가 상세 필드로 확장되고, 웨이블존의 시설·운영시간·평점·리뷰수 관리, 사용자 장소 및 매핑 엔티티가 새로 도입되었습니다.

Changes

파일/그룹 변경 요약
ReviewController.java, ReviewService.java, ReviewRepository.java 웨이블존별 리뷰 목록 GET API 추가, 정렬(최신/평점순) 지원, 서비스 및 레포지토리 메서드 신설
ReviewResponseDto.java 리뷰 응답 DTO를 상세 필드(리뷰ID, 닉네임, 평점, 내용, 방문일, 좋아요, 이미지 리스트)로 확장
WaybleZone.java 평점, 리뷰수, 시설, 운영시간, 사용자장소 매핑 등 필드 및 연관관계 추가
WaybleZoneFacility.java, WaybleZoneOperatingHour.java 웨이블존 시설 및 운영시간 JPA 엔티티 신설
UserPlace.java, UserPlaceWaybleZoneMapping.java 사용자 저장 장소, 장소-웨이블존 매핑 JPA 엔티티 신설
WaybleZoneErrorCase.java 웨이블존 미존재 오류코드의 HTTP 상태코드 404로 변경 및 메시지 수정

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ReviewController
    participant ReviewService
    participant ReviewRepository
    participant WaybleZone

    Client->>ReviewController: GET /reviews?waybleZoneId={id}&sort={sort}
    ReviewController->>ReviewService: getReviews(waybleZoneId, sort)
    ReviewService->>WaybleZone: 웨이블존 존재 확인
    alt 웨이블존 존재
        ReviewService->>ReviewRepository: findByWaybleZoneIdOrderBy...(waybleZoneId)
        ReviewRepository-->>ReviewService: List<Review>
        ReviewService-->>ReviewController: List<ReviewResponseDto>
        ReviewController-->>Client: CommonResponse<List<ReviewResponseDto>>
    else 웨이블존 없음
        ReviewService-->>ReviewController: 예외 발생 (404)
        ReviewController-->>Client: 404 Not Found
    end
Loading

Possibly related PRs

Suggested reviewers

  • KiSeungMin

Poem

🐇
리뷰가 쏟아지는 웨이블존,
최신순, 평점순 고르는 건 너의 몫!
시설·운영시간 정보도 똑똑하게,
저장한 장소도 연결되어
토끼는 오늘도 기쁘게 깡총깡총!

"리뷰의 숲에서 만나요!"

"""

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

@seung-in-Yoo seung-in-Yoo linked an issue Jul 9, 2025 that may be closed by this pull request
2 tasks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/main/java/com/wayble/server/review/controller/ReviewController.java (1)

45-56: 잘 구성된 리뷰 조회 엔드포인트입니다.

OpenAPI 문서화도 적절하고, 기본값 설정도 좋습니다.

sort 파라미터에 대한 입력 검증을 추가하는 것을 고려해보세요:

public CommonResponse<List<ReviewResponseDto>> getReviews(
        @PathVariable Long waybleZoneId,
-       @RequestParam(defaultValue = "latest") String sort
+       @RequestParam(defaultValue = "latest") @Pattern(regexp = "^(latest|rating)$", message = "정렬 방식은 'latest' 또는 'rating'만 가능합니다.") String sort
) {
src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1)

27-34: 데이터 타입 개선을 고려해보세요.

현재 요일과 시간을 String으로 저장하고 있는데, 다음과 같은 개선을 고려해볼 수 있습니다:

-    @Column(name = "day_of_week", nullable = false)
-    private String dayOfWeek; // 요일 정보
+    @Enumerated(EnumType.STRING)
+    @Column(name = "day_of_week", nullable = false)
+    private DayOfWeek dayOfWeek; // 요일 정보

-    @Column(name = "start_time", nullable = false)
-    private String startTime; // 영업 시작 시간
+    @Column(name = "start_time", nullable = false)
+    private LocalTime startTime; // 영업 시작 시간

-    @Column(name = "close_time", nullable = false)
-    private String closeTime; // 영업 종료 시간
+    @Column(name = "close_time", nullable = false)
+    private LocalTime closeTime; // 영업 종료 시간

이렇게 하면 타입 안정성이 향상되고 시간 계산 등의 작업이 더 쉬워집니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b6ae102 and a45694d.

📒 Files selected for processing (10)
  • src/main/java/com/wayble/server/review/controller/ReviewController.java (3 hunks)
  • src/main/java/com/wayble/server/review/dto/ReviewResponseDto.java (1 hunks)
  • src/main/java/com/wayble/server/review/repository/ReviewRepository.java (1 hunks)
  • src/main/java/com/wayble/server/review/service/ReviewService.java (3 hunks)
  • src/main/java/com/wayble/server/user/entity/UserPlace.java (1 hunks)
  • src/main/java/com/wayble/server/user/entity/UserPlaceWaybleZoneMapping.java (1 hunks)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZone.java (2 hunks)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneFacility.java (1 hunks)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1 hunks)
  • src/main/java/com/wayble/server/wayblezone/exception/WaybleZoneErrorCase.java (1 hunks)
🔇 Additional comments (10)
src/main/java/com/wayble/server/wayblezone/exception/WaybleZoneErrorCase.java (1)

11-11: 올바른 HTTP 상태 코드 수정입니다.

웨이블존이 존재하지 않을 때 404 상태 코드를 반환하는 것이 RESTful API의 표준에 맞습니다. 에러 메시지도 더 구체적으로 개선되었습니다.

src/main/java/com/wayble/server/review/dto/ReviewResponseDto.java (1)

6-14: 포괄적인 리뷰 응답 DTO 구조입니다.

리뷰 정보를 나타내는 모든 필요한 필드들이 적절한 Java 타입으로 정의되어 있습니다. Record 사용도 불변 데이터 구조에 적합합니다.

src/main/java/com/wayble/server/review/repository/ReviewRepository.java (1)

9-10: 데이터베이스 인덱스 정의 여부 직접 확인 필요

자동화된 검색 결과 인덱스(@Index 또는 CREATE INDEX) 정의를 찾지 못했습니다. 아래 위치를 직접 점검해 주세요:

  • Java 엔티티 클래스 (@Table(indexes = …))
    • src/main/java/.../entity/Review.java 등 관련 엔티티 파일
  • SQL 마이그레이션 스크립트 (src/main/resources/db/migration 또는 유사 디렉터리) 내 CREATE INDEX 구문

위치에 인덱스가 없다면, wayble_zone_id, created_at, rating 컬럼에 대해 적절한 인덱스를 추가해 주시기 바랍니다.

src/main/java/com/wayble/server/review/service/ReviewService.java (1)

51-59: 적절한 정렬 로직과 예외 처리입니다.

웨이블존 존재 여부 확인과 switch 표현식을 통한 정렬 처리가 올바르게 구현되었습니다.

src/main/java/com/wayble/server/user/entity/UserPlaceWaybleZoneMapping.java (1)

10-29: 매핑 엔티티 구현이 잘 되어 있습니다.

UserPlace와 WaybleZone 간의 다대다 관계를 위한 매핑 엔티티가 적절히 구현되었습니다. 지연 로딩 사용과 non-nullable 외래키 설정이 적절합니다.

src/main/java/com/wayble/server/user/entity/UserPlace.java (1)

11-29: 사용자 장소 엔티티가 적절히 구현되었습니다.

BaseEntity를 상속받고 User와의 관계를 지연 로딩으로 설정한 것이 좋습니다. 간단하고 명확한 엔티티 구조입니다.

src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneFacility.java (1)

8-43: 시설 정보 엔티티가 잘 설계되었습니다.

접근성 관련 시설 정보를 불리언 필드로 관리하는 것이 적절하며, WaybleZone과의 일대일 관계가 올바르게 설정되었습니다. 층수 정보를 nullable로 설정한 것도 합리적입니다.

src/main/java/com/wayble/server/wayblezone/entity/WaybleZone.java (3)

6-6: 새로운 import가 적절히 추가되었습니다.

UserPlaceWaybleZoneMapping 관련 import가 올바르게 추가되었습니다.


40-44: 평점과 리뷰 수 필드가 잘 추가되었습니다.

rating과 reviewCount 필드가 적절한 기본값과 함께 추가되었습니다. 리뷰 기능 구현에 필요한 필드들입니다.


52-59: 새로운 관계들이 적절히 매핑되었습니다.

운영시간, 시설정보, 사용자 장소 매핑과의 관계가 올바르게 설정되었습니다. CASCADE와 orphanRemoval 설정이 적절합니다.

Comment thread src/main/java/com/wayble/server/review/service/ReviewService.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a45694d and d4d45c7.

📒 Files selected for processing (2)
  • src/main/java/com/wayble/server/review/controller/ReviewController.java (2 hunks)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/wayble/server/review/controller/ReviewController.java
🔇 Additional comments (2)
src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (2)

1-11: 패키지 및 임포트 구조가 적절합니다.

필요한 JPA, Lombok, 시간 관련 클래스들이 올바르게 임포트되어 있습니다.


14-20: 엔티티 어노테이션 구성이 적절합니다.

JPA 엔티티 설정과 Lombok 어노테이션이 올바르게 구성되어 있으며, 테이블명도 명확합니다.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1)

44-50: 야간 영업 시간 처리에 대한 검토가 필요합니다.

현재 검증 로직은 startTime.isAfter(closeTime)일 때 예외를 발생시키지만, 야간 영업하는 경우(예: 23:00 ~ 02:00)에는 시작 시간이 종료 시간보다 늦을 수 있습니다.

비즈니스 요구사항에 따라 야간 영업이 필요한 경우 다음과 같은 개선을 고려하세요:

 @PrePersist
 @PreUpdate
 private void validateTimes() {
-    if (!isClosed && startTime != null && closeTime != null && startTime.isAfter(closeTime)) {
-        throw new IllegalStateException("시작 시간은 종료 시간보다 앞서야 합니다.");
+    if (!isClosed && startTime != null && closeTime != null && startTime.equals(closeTime)) {
+        throw new IllegalStateException("시작 시간과 종료 시간이 동일할 수 없습니다.");
     }
 }

또는 야간 영업 여부를 나타내는 별도 필드를 추가하여 더 명확하게 처리할 수 있습니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d4d45c7 and dadf282.

📒 Files selected for processing (2)
  • src/main/java/com/wayble/server/review/controller/ReviewController.java (2 hunks)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/wayble/server/review/controller/ReviewController.java
🔇 Additional comments (2)
src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (2)

19-20: 이전 리뷰 지적사항이 적절히 반영되었습니다.

웨이블존과 요일 조합에 대한 유니크 제약조건이 올바르게 추가되어 동일한 웨이블존에 대해 같은 요일의 영업시간이 중복으로 저장되는 것을 방지합니다.


41-42: 휴무일 처리를 위한 필드가 적절히 추가되었습니다.

isClosed 필드가 추가되어 특정 요일에 휴무인 경우를 처리할 수 있게 되었습니다. 기본값 false도 적절합니다.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (2)
src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (2)

19-20: 유니크 제약조건이 적절히 추가되었습니다.

웨이블존과 요일 조합에 대한 유니크 제약조건이 올바르게 구현되어 중복 데이터 생성을 방지합니다.


44-61: 검증 로직이 잘 구현되었습니다.

휴무일과 영업일에 대한 시간 필드 검증 로직이 포괄적으로 구현되어 데이터 무결성을 보장합니다. 특히 시작 시간과 종료 시간이 동일한 경우에 대한 검증도 포함되어 있어 좋습니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dadf282 and 38baa09.

📒 Files selected for processing (1)
  • src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (1 hunks)
🔇 Additional comments (4)
src/main/java/com/wayble/server/wayblezone/entity/WaybleZoneOperatingHour.java (4)

1-12: 패키지 선언과 임포트 구조가 적절합니다.

필요한 라이브러리들이 올바르게 임포트되었고, 패키지 구조가 적절합니다.


27-29: WaybleZone과의 관계 매핑이 적절합니다.

Lazy 로딩과 적절한 조인 컬럼 설정으로 성능과 데이터 무결성을 모두 고려한 구현입니다.


31-33: 요일 정보 매핑이 적절합니다.

Java의 DayOfWeek enum을 사용하여 타입 안전성을 보장하고, STRING 타입으로 저장하여 가독성을 높였습니다.


41-42: 기본값 설정이 적절합니다.

isClosed 필드에 기본값 false를 설정하여 명시적으로 휴무일을 표시하지 않은 경우 영업일로 처리되도록 하였습니다.

@KiSeungMin KiSeungMin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

수고 많으셨습니다!!

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

Labels

💡 feature 기능 구현 및 개발 🔧 refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 웨이블존 리뷰 목록 조회 API 구현하기

2 participants