-
Notifications
You must be signed in to change notification settings - Fork 1
[feat] 웨이블존 상세 조회 API 구현 #33
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
WalkthroughWaybleZone 상세 조회 API가 새롭게 추가되어, 컨트롤러, 서비스, DTO 계층에 각각 상세 정보를 반환하는 기능이 구현되었습니다. 또한 시설 정보 DTO가 공통 패키지로 분리되어 관련 DTO들이 이를 참조하도록 리팩토링되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller as WaybleZoneController
participant Service as WaybleZoneService
participant Repo as WaybleZoneRepository
Client->>Controller: GET /wayblezone/{waybleZoneId}
Controller->>Service: getWaybleZoneDetail(waybleZoneId)
Service->>Repo: findById(waybleZoneId)
Repo-->>Service: WaybleZone 엔티티 반환/없으면 예외
Service->>Service: 시설/이미지/영업시간 데이터 조립
Service-->>Controller: WaybleZoneDetailResponseDto 반환
Controller-->>Client: 상세 정보 응답 반환
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🔭 Outside diff range comments (1)
src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java (1)
52-60: 중복 코드를 공통 메서드로 추출하세요.FacilityDto 빌드 로직이 기존 메서드와 중복됩니다. 이를 별도 메서드로 추출하여 코드 중복을 제거하는 것이 좋겠습니다.
+private FacilityDto buildFacilityDto(WaybleZoneFacility f) { + return FacilityDto.builder() + .hasSlope(f.isHasSlope()) + .hasNoDoorStep(f.isHasNoDoorStep()) + .hasElevator(f.isHasElevator()) + .hasTableSeat(f.isHasTableSeat()) + .hasDisabledToilet(f.isHasDisabledToilet()) + .floorInfo(f.getFloorInfo()) + .build(); +}그리고 두 메서드에서 이 공통 메서드를 사용하도록 변경하세요.
Also applies to: 96-103
🧹 Nitpick comments (4)
src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java (1)
64-106: 성능 최적화를 위해 fetch join 사용을 고려하세요.현재 구현에서는 연관된 엔티티들(images, operatingHours)을 지연 로딩으로 가져오므로 N+1 쿼리 문제가 발생할 수 있습니다.
Repository에 fetch join을 사용하는 메서드를 추가하는 것을 고려해보세요:
@Query("SELECT w FROM WaybleZone w " + "LEFT JOIN FETCH w.waybleZoneImageList " + "LEFT JOIN FETCH w.operatingHours " + "WHERE w.id = :id") Optional<WaybleZone> findByIdWithDetails(@Param("id") Long id);src/main/java/com/wayble/server/wayblezone/controller/WaybleZoneController.java (2)
27-38: API 문서화가 잘 되어 있습니다.OpenAPI 어노테이션을 통한 상세한 API 문서화가 잘 구현되었습니다. 다만 향후 국제화를 고려한다면 설명 텍스트를 메시지 프로퍼티로 분리하는 것을 고려해보세요.
48-51: 일관성을 위해 ApiResponses 어노테이션 스타일을 통일하세요.기존 메서드는
@ApiResponses(value = {})형태를, 새 메서드는@ApiResponses({})형태를 사용합니다. 일관성을 위해 스타일을 통일하는 것이 좋겠습니다.src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneDetailResponseDto.java (1)
24-27: BusinessHourDto의 타입 고려사항open, close 필드가 String 타입으로 정의되어 있는데, 이는 유연성을 제공하지만 타입 안전성은 떨어집니다. 현재 구현이 요구사항에 맞다면 문제없지만, 향후 시간 연산이 필요하다면 LocalTime 사용을 고려해보세요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/com/wayble/server/common/dto/FacilityDto.java(1 hunks)src/main/java/com/wayble/server/wayblezone/controller/WaybleZoneController.java(2 hunks)src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneDetailResponseDto.java(1 hunks)src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneListResponseDto.java(2 hunks)src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java(2 hunks)
🔇 Additional comments (5)
src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneListResponseDto.java (1)
3-3: 리팩토링이 잘 적용되었습니다.FacilityDto를 공통 패키지로 분리하여 코드 중복을 제거한 것이 좋은 개선입니다. 이를 통해 일관성 있는 시설 정보 표현이 가능해졌습니다.
src/main/java/com/wayble/server/common/dto/FacilityDto.java (1)
5-13: 잘 설계된 공통 DTO입니다.Record와 @builder 조합으로 불변 객체를 만들어 안전한 설계가 되었습니다. 시설 관련 필드명들도 명확하여 가독성이 좋습니다.
src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java (1)
75-84: 운영시간 맵 생성 로직이 우아합니다.LinkedHashMap을 사용하여 순서를 보장하고, DateTimeFormatter로 일관된 시간 포맷을 제공하는 것이 좋은 구현입니다.
src/main/java/com/wayble/server/wayblezone/controller/WaybleZoneController.java (1)
46-56: 상세 조회 엔드포인트가 올바르게 구현되었습니다.RESTful한 URL 패턴과 적절한 검증, 문서화가 포함된 깔끔한 구현입니다.
src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneDetailResponseDto.java (1)
9-22: 잘 설계된 응답 DTO입니다.Record 타입과 빌더 패턴을 사용한 불변 객체 설계가 훌륭합니다. 공통 FacilityDto 재사용으로 일관성도 확보되었습니다.
| String imageUrl, | ||
| FacilityDto facilities, | ||
| Map<String, BusinessHourDto> businessHours, | ||
| List<String> photos |
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.
💡 Verification agent
🧩 Analysis chain
필드 네이밍의 명확성을 검토하세요.
imageUrl과 photos 필드의 관계가 명확하지 않습니다. imageUrl이 대표 이미지이고 photos가 전체 이미지 목록이라면, mainImageUrl 등의 더 명확한 네이밍을 고려해보세요.
다음 스크립트로 사용 패턴을 확인해주세요:
🏁 Script executed:
#!/bin/bash
# imageUrl과 photos 필드 사용 패턴 확인
rg -A 5 -B 5 "imageUrl|photos" --type javaLength of output: 10064
필드 네이밍 명확성 검토
imageUrl이 첫 번째(대표) 이미지이고 photos가 전체 이미지 목록임이 확인되었습니다. 싱글 vs 플럴 구분으로도 식별은 되지만, 가독성과 명시성을 위해 아래와 같이 변경을 제안드립니다.
– 대상 파일
• src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneDetailResponseDto.java
• src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneListResponseDto.java
– 제안 변경사항
- String imageUrl,
+ String mainImageUrl,
…
- List<String> photos
+ List<String> photoUrls서비스 레이어에서 .imageUrl(imageUrl) → .mainImageUrl(imageUrl) ,
.photos(photoUrls) → .photoUrls(photoUrls) 로 빌더 호출부도 함께 수정해주세요.
📝 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.
| String imageUrl, | |
| FacilityDto facilities, | |
| Map<String, BusinessHourDto> businessHours, | |
| List<String> photos | |
| String mainImageUrl, | |
| FacilityDto facilities, | |
| Map<String, BusinessHourDto> businessHours, | |
| List<String> photoUrls |
🤖 Prompt for AI Agents
In
src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneDetailResponseDto.java
around lines 18 to 21, rename the field 'imageUrl' to 'mainImageUrl' and
'photos' to 'photoUrls' to improve clarity and explicitness. Also, update all
corresponding builder method calls in the service layer from
'.imageUrl(imageUrl)' to '.mainImageUrl(imageUrl)' and from '.photos(photoUrls)'
to '.photoUrls(photoUrls)' to maintain consistency.
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.
@seung-in-Yoo 네, 알겠습니다! 현재 필드명으로 충분히 의미가 전달되고 있으니 나중에 필요할 때 변경하시는 것으로 하겠습니다. 👍
#️⃣ 연관된 이슈
#30
📝 작업 내용
웨이블존 상세 조회 API (GET /api/v1/wayble-zones/{waybleZoneId}) 구현
웨이블존 상세 정보, 편의시설, 운영시간, 이미지 목록 포함
운영시간은 요일별로 분류 후, DTO에 open/close 시간 포함
FacilityDto가 웨이블존 목록 조회, 상세 조회 두 부분에서 중복으로 사용하기 때문에 공통 사용을 위해 common -> dto로 추가
WaybleZoneService에서 시설 및 이미지가 존재하지 않는다면 null-safe 로직 처리
📸 스크린샷 (선택)
응답성공
응답실패
💬 리뷰 요구사항 (선택)
Summary by CodeRabbit
신규 기능
버그 수정
문서화