Skip to content

Conversation

@buzz0331
Copy link
Contributor

@buzz0331 buzz0331 commented Nov 3, 2025

#️⃣연관된 이슈

📝작업 내용

딱히 특이사항 없습니다.
정렬 조건은 평점 높은 순이고, 만약 이때 평점 이 같아서 7개가 넘어갈 경우 평점 갯수가 많은 순으로 정렬합니다.

스크린샷 (선택)

💬리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

Summary by CodeRabbit

  • 새로운 기능
    • 상위 평점 푸드트럭 조회 기능 추가: 평점 기준 상위 푸드트럭 목록(최대 7개)을 제공합니다.
    • 신규 API 엔드포인트 추가 (GET /top-rated): 인증된 사용자가 상위 푸드트럭을 조회할 수 있습니다.
  • 문서
    • OpenAPI/Swagger 응답 설명에 상위 평점 조회 항목 추가.
  • 기타
    • 상위 평점 응답용 간결한 반환 형식 추가로 결과가 요약되어 제공됩니다.

@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Walkthrough

상위 평점 순 푸드트럭 조회 기능이 추가되었습니다. 컨트롤러 엔드포인트, 서비스 호출(회원 검증 포함), 정보 서비스의 페이징 기반 조회와 DTO, 저장소 쿼리, Swagger 응답 설명이 도입되었습니다. FoodTruckInfoService에 동일한 메서드가 중복 정의된 것으로 보입니다.

Changes

Cohort / File(s) 변경 요약
API 엔드포인트
\src/main/java/konkuk/chacall/domain/foodtruck/presentation/FoodTruckController.java``
GET /top-rated 엔드포인트 추가 (@UserId로 memberId 수신, foodTruckService.getTopRatedFoodTrucks(memberId) 호출, BaseResponse<List<FoodTruckTopRateResponse>> 반환)
서비스 계층
\src/main/java/konkuk/chacall/domain/foodtruck/application/FoodTruckService.java`, `src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java``
FoodTruckService#getTopRatedFoodTrucks(Long memberId) 추가(회원 검증 후 InfoService 호출). FoodTruckInfoService#getTopRatedFoodTrucks() 추가 및 TOP_RATED_FOOD_TRUCK_LIMIT = 7 도입 — 파일 내 동일 메서드 중복 정의 존재
저장소 계층
\src/main/java/konkuk/chacall/domain/foodtruck/domain/repository/FoodTruckRepository.java``
findTopRatedFoodTrucks(Pageable pageable) 메서드 추가: status = APPROVED, viewed = ON 필터, ratingInfo.averageRating 내림차순 및 ratingCount 내림차순 정렬로 Pageable 기반 조회
응답 DTO
\src/main/java/konkuk/chacall/domain/foodtruck/presentation/dto/response/FoodTruckTopRateResponse.java``
새 레코드 FoodTruckTopRateResponse 추가(foodTruckId, name, photoUrl, averageRating) 및 from(FoodTruck) 매핑 정적 메서드 추가
Swagger 응답 설명
\src/main/java/konkuk/chacall/global/common/swagger/SwaggerResponseDescription.java``
새 enum 상수 GET_TOP_RATED_FOOD_TRUCKS 추가(공통 오류 집합에 USER_NOT_FOUND, USER_FORBIDDEN 포함)

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Client
    participant Controller as FoodTruckController
    participant Service as FoodTruckService
    participant Validator as MemberValidator
    participant InfoService as FoodTruckInfoService
    participant Repository as FoodTruckRepository

    Client->>Controller: GET /top-rated (memberId)
    Controller->>Service: getTopRatedFoodTrucks(memberId)
    Service->>Validator: validateAndGetMember(memberId)
    Validator-->>Service: Member
    Service->>InfoService: getTopRatedFoodTrucks()
    InfoService->>Repository: findTopRatedFoodTrucks(PageRequest(0, TOP_RATED_FOOD_TRUCK_LIMIT))
    Repository-->>InfoService: List<FoodTruck>
    InfoService->>InfoService: map -> List<FoodTruckTopRateResponse>
    InfoService-->>Service: List<FoodTruckTopRateResponse>
    Service-->>Controller: List<FoodTruckTopRateResponse>
    Controller->>Client: 200 OK + BaseResponse(payload)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 분

  • 주의 필요 영역:
    • FoodTruckInfoServicegetTopRatedFoodTrucks() 중복 정의(중복 제거 필요)
    • FoodTruckRepository.findTopRatedFoodTrucks(Pageable)의 JPQL/Query 문법 및 페이징 적용 검증
    • FoodTruckTopRateResponse.from()의 중첩 필드 접근(null 안전성) 검사
    • 컨트롤러의 @UserId 추출 및 멤버 검증 예외 매핑 확인

Possibly related PRs

Suggested reviewers

  • ksg1227

Poem

🐰 위로 홱, 별점 일곱 줄,
쿼리로 꿀을 쏙, 응답에 포근함,
검증은 발끝에 톡, 매핑은 부드럽게,
홈 화면엔 환한 한입의 기쁨. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
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.
Out of Scope Changes check ❓ Inconclusive FoodTruckInfoService에서 동일한 public 메서드가 중복으로 존재하는 것으로 보여, 이는 이슈 범위 내의 구현이나 코드 품질 문제가 될 수 있습니다. FoodTruckInfoService의 메서드 중복 정의 여부를 확인하고 중복된 부분을 제거하거나 의도적 구현인지 명확히 해주시기 바랍니다.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 '홈화면 평점 높은 순 푸드트럭 조회 API 구현'으로, 변경 사항의 주요 내용을 명확하게 설명하고 있습니다.
Linked Issues check ✅ Passed 변경사항이 이슈 #24의 요구사항인 '홈화면용 평점 높은 순 푸드트럭 조회 API'를 구현하였으며, 정렬 규칙도 올바르게 적용되었습니다.
✨ 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 feat/#24-home-rating-food-truck

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.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (1)

14-42: Pageable 전달로 상위 N 제한 적용 필요
저장소 메서드를 Pageable로 바꾸면 여기서도 PageRequest를 생성해 전달해야 정상 동작합니다.

+import org.springframework.data.domain.PageRequest;
...
-        return foodTruckRepository.findTopRatedFoodTrucks(TOP_RATED_FOOD_TRUCK_LIMIT).stream()
+        return foodTruckRepository.findTopRatedFoodTrucks(PageRequest.of(0, TOP_RATED_FOOD_TRUCK_LIMIT)).stream()
                 .map(FoodTruckTopRateResponse::from)
                 .toList();

Also applies to: 161-165

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef6c144 and 92401f9.

📒 Files selected for processing (5)
  • src/main/java/konkuk/chacall/domain/foodtruck/application/FoodTruckService.java (1 hunks)
  • src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (3 hunks)
  • src/main/java/konkuk/chacall/domain/foodtruck/domain/repository/FoodTruckRepository.java (2 hunks)
  • src/main/java/konkuk/chacall/domain/foodtruck/presentation/FoodTruckController.java (1 hunks)
  • src/main/java/konkuk/chacall/domain/foodtruck/presentation/dto/response/FoodTruckTopRateResponse.java (1 hunks)

Copy link
Contributor

@ksg1227 ksg1227 left a comment

Choose a reason for hiding this comment

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

확인했습니다! 피드백 한 번만 확인 부탁드려요~

@buzz0331
Copy link
Contributor Author

buzz0331 commented Nov 5, 2025

확인했습니다! 피드백 한 번만 확인 부탁드려요~

수정했습니다!

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/konkuk/chacall/domain/foodtruck/domain/repository/FoodTruckRepository.java (1)

57-64: 이전 피드백 반영 완료 및 구현 확인

이전 리뷰에서 지적된 JPQL limit 절 문법 오류가 올바르게 수정되었습니다:

  • Pageable 파라미터 사용으로 변경
  • ✅ JPQL에서 limit :limit 절 제거
  • ✅ 필터 조건(APPROVED, ON) 및 정렬 순서(averageRating desc, ratingCount desc)가 요구사항과 일치

호출부(FoodTruckInfoService.getTopRatedFoodTrucks())에서 PageRequest.of(0, 7)을 전달하고 있어 전체 흐름이 정상입니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a39b30 and 42dfead.

📒 Files selected for processing (2)
  • src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (4 hunks)
  • src/main/java/konkuk/chacall/domain/foodtruck/domain/repository/FoodTruckRepository.java (1 hunks)
🔇 Additional comments (2)
src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (2)

44-44: 상수 선언 적절함

상수명이 명확하고, 값이 요구사항(상위 7개)과 일치합니다.


164-168: 메서드 구현 로직 정확함

평점 상위 푸드트럭 조회 로직이 올바르게 구현되었습니다:

  • PageRequest.of(0, 7)로 첫 페이지 7개 조회
  • Repository의 정렬 로직(평점 내림차순, 평점 개수 내림차순)을 활용
  • DTO 매핑이 적절함

Line 23-25의 import 문제만 수정되면 정상 동작할 것입니다.

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 (1)
src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (1)

162-166: 선택적 개선: 저장 상태 정보 포함 고려

getFoodTrucks 메서드(Line 54)와 달리 이 메서드는 푸드트럭의 저장 상태(찜 여부)를 포함하지 않습니다. 홈 화면에서 사용자 경험을 향상시키려면 저장 상태 정보를 추가하는 것을 고려해볼 수 있습니다.

다만 현재 메서드 시그니처가 파라미터가 없으므로, 이는 의도적으로 공개/익명 접근을 허용하는 것일 수 있습니다. 필요시 향후 개선할 수 있는 사항입니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42dfead and 209461b.

📒 Files selected for processing (1)
  • src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (4 hunks)
🔇 Additional comments (2)
src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java (2)

14-14: LGTM!

DTO import와 상수 정의가 적절합니다. TOP_RATED_FOOD_TRUCK_LIMIT = 7은 PR 요구사항과 일치합니다.

Also applies to: 42-43


162-166: 코드 검증 완료 - 모든 우려사항 해소됨

검증 결과:

  1. 중복 메서드: 없음 - getTopRatedFoodTrucks() 메서드는 파일 내 단 한 번만 정의되어 있습니다.

  2. 정렬 로직: ✅ 올바르게 구현됨

    • @Query 주석에서 order by f.ratingInfo.averageRating desc, f.ratingInfo.ratingCount desc로 정렬
    • PR 요구사항(평점 내림차순, 동점 시 리뷰 수 내림차순)을 정확히 충족합니다.
  3. 상태 필터링: ✅ 적절하게 적용됨

    • f.foodTruckStatus = 'APPROVED'
    • f.foodTruckViewedStatus = 'ON'

메서드 구현이 정확하고 모든 요구사항을 충족합니다.

Copy link
Contributor

@ksg1227 ksg1227 left a comment

Choose a reason for hiding this comment

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

굿!

@buzz0331 buzz0331 merged commit 3c17042 into develop Nov 13, 2025
2 checks passed
@buzz0331 buzz0331 deleted the feat/#24-home-rating-food-truck branch November 13, 2025 09:03
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.

[FEAT] 홈화면 평점 높은 순 푸드트럭 조회 API 구현

3 participants