-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 홈화면 평점 높은 순 푸드트럭 조회 API 구현 #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough상위 평점 순 푸드트럭 조회 기능이 추가되었습니다. 컨트롤러 엔드포인트, 서비스 호출(회원 검증 포함), 정보 서비스의 페이징 기반 조회와 DTO, 저장소 쿼리, Swagger 응답 설명이 도입되었습니다. FoodTruckInfoService에 동일한 메서드가 중복 정의된 것으로 보입니다. Changes
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 분
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
📒 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)
src/main/java/konkuk/chacall/domain/foodtruck/domain/repository/FoodTruckRepository.java
Outdated
Show resolved
Hide resolved
ksg1227
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다! 피드백 한 번만 확인 부탁드려요~
수정했습니다! |
There was a problem hiding this 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
📒 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 문제만 수정되면 정상 동작할 것입니다.
src/main/java/konkuk/chacall/domain/foodtruck/application/info/FoodTruckInfoService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
📒 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: 코드 검증 완료 - 모든 우려사항 해소됨검증 결과:
중복 메서드: 없음 -
getTopRatedFoodTrucks()메서드는 파일 내 단 한 번만 정의되어 있습니다.정렬 로직: ✅ 올바르게 구현됨
@Query주석에서order by f.ratingInfo.averageRating desc, f.ratingInfo.ratingCount desc로 정렬- PR 요구사항(평점 내림차순, 동점 시 리뷰 수 내림차순)을 정확히 충족합니다.
상태 필터링: ✅ 적절하게 적용됨
f.foodTruckStatus = 'APPROVED'f.foodTruckViewedStatus = 'ON'메서드 구현이 정확하고 모든 요구사항을 충족합니다.
ksg1227
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿!
#️⃣연관된 이슈
📝작업 내용
딱히 특이사항 없습니다.
정렬 조건은 평점 높은 순이고, 만약 이때 평점 이 같아서 7개가 넘어갈 경우 평점 갯수가 많은 순으로 정렬합니다.
스크린샷 (선택)
💬리뷰 요구사항(선택)
Summary by CodeRabbit