-
Notifications
You must be signed in to change notification settings - Fork 0
♻️refactor : 노선도 상세 설명 수정 #77
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
The head ref may contain hidden characters: "feat/\uB300\uC911\uAD50\uD1B5-\uC218\uC815"
Conversation
Walkthrough다중 경로 대중교통 응답 DTO Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ComplexApi as API
participant ComplexService as Service
participant DistanceUtil as PathEngine
participant TransitMapper as Mapper
Client->>API: GET /distance?complexId=&pinPointId=
API->>Service: getDistanceV2(complexId, pinPointId)
Service->>PathEngine: findPathResult(complex, pinPoint)
PathEngine-->>Service: PathResult
Service->>Mapper: toTransitRoutesResponse(PathResult)
Mapper-->>Service: TransitRoutesResponse
Service-->>API: TransitRoutesResponse
API-->>Client: ApiResponse<TransitRoutesResponse>
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 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
🧹 Nitpick comments (7)
src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java (4)
449-472: 사용되지 않는 매개변수isInferred제거를 고려하세요.
createBoardStep메서드에서isInferred매개변수가 선언되었지만 메서드 내부에서 전혀 사용되지 않습니다. 동일하게createAlightStep(Line 477)에서도 마찬가지입니다.- private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { + private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, ChipType chipType) {
548-551:shortenLineLabel메서드의 불필요한 replace 호출이 있습니다.
.replace("호선", "호선")은 동일한 문자열로 치환하므로 아무 효과가 없습니다. 의도한 동작이 다르다면 수정이 필요합니다.private String shortenLineLabel(String label) { if (label == null) return null; - return label.replace("수도권 ", "").replace("호선", "호선"); + return label.replace("수도권 ", ""); }
479-479: 사용되지 않는 변수shortLabel이 있습니다.
createAlightStep메서드에서shortLabel변수가 선언 및 할당되었지만 사용되지 않습니다.createBoardStep(Line 451)에서도 동일한 문제가 있습니다.private TransitRoutesResponse.StepResponse createAlightStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { String stopType = getStopTypeSuffix(step.type()); - String shortLabel = shortenLineLabel(step.lineInfo()); // 색상 추출 (ALIGHT는 해당 교통수단의 색상 유지)
515-531:assignStepIndexes메서드에서 전체 객체를 재생성합니다.인덱스만 업데이트하기 위해 모든 필드를 복사하여 새 객체를 생성하고 있습니다. Java record의 경우
with패턴이 지원되지 않으므로 현재 방식이 불가피하나, 초기 생성 시점에 올바른 인덱스를 설정하는 방식으로 리팩토링하면 불필요한 객체 생성을 줄일 수 있습니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/service/ComplexService.java (1)
144-167: 읽기 전용 트랜잭션 사용을 권장합니다.
getDistanceV2메서드는 데이터를 조회만 하고 수정하지 않습니다.getEasyDistance(Line 468)처럼@Transactional(readOnly = true)를 사용하면 데이터베이스 최적화 혜택을 받을 수 있습니다./// 대중교통 시뮬레이터 (새 스키마 - 3개 경로 한 번에) @Override - @Transactional + @Transactional(readOnly = true) public TransitRoutesResponse getDistanceV2(String id, String pinPointId) throws UnsupportedEncodingException {참고: 기존
getDistance메서드(Line 113)도 동일하게readOnly = true가 적절해 보입니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java (1)
3-5: 사용되지 않는 import 문이 있습니다.
JsonIgnore와LineInfo가 import되었지만 파일 내에서 사용되지 않습니다.package com.pinHouse.server.platform.housing.complex.application.dto.response; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; -import com.pinHouse.server.platform.housing.complex.application.dto.result.LineInfo; import io.swagger.v3.oas.annotations.media.Schema;src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java (1)
56-56: 임시 주석 여부를 검토하세요."(새 스키마)" 주석이 추가되었는데, 이것이 마이그레이션 기간 동안만 필요한 임시 주석인지 확인해 주세요. 마이그레이션이 완료되면 제거하는 것을 고려하세요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java(1 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/service/ComplexService.java(2 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/usecase/ComplexUseCase.java(2 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java(2 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ComplexApi.java(2 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java(4 hunks)src/main/java/com/pinHouse/server/platform/housing/facility/presentation/swagger/FacilityApiSpec.java(1 hunks)
🔇 Additional comments (8)
src/main/java/com/pinHouse/server/platform/housing/facility/presentation/swagger/FacilityApiSpec.java (1)
24-24: 복잡 ID 예제 값 업데이트가 관련 API 스펙에서 일관되게 적용되었습니다.새로운 예제 ID "19413#1"이 ComplexApiSpec.java의 여러 위치(줄 30, 42, 61)에서도 동일하게 사용되고 있습니다. 이전 예제 ID "19231#37"은 코드베이스에서 완전히 제거되었으며, 이는 API 문서의 예제 데이터가 의도적으로 업데이트되었음을 나타냅니다.
src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java (2)
383-390: 하차(ALIGHT) step 생성 조건 로직 검토가 필요합니다.현재 로직에서 마지막 교통수단이 아니면서 다음이 WALK가 아닌 경우에는 ALIGHT step이 생성되지 않습니다. 예를 들어 BUS → SUBWAY로 바로 환승하는 경우, BUS에서의 하차 정보가 누락될 수 있습니다.
실제 데이터에서 WALK 없이 교통수단 간 직접 환승이 발생하는지 확인해 주세요.
278-298: LGTM!
toTransitRoutesResponse메서드가 null 및 빈 입력을 적절히 처리하고,selectTop3를 통해 상위 3개 경로를 선택하여 변환합니다. 구조가 명확합니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/usecase/ComplexUseCase.java (1)
29-34: LGTM!기존
getDistance메서드를 유지하면서 새로운getDistanceV2메서드를 추가하여 하위 호환성을 보장합니다. 인터페이스 설계가 적절합니다.src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ComplexApi.java (1)
72-83: API 응답 타입 변경으로 인한 Breaking Change가 발생합니다.기존
/v1/complexes/transit/{complexId}엔드포인트의 반환 타입이List<DistanceResponse>에서TransitRoutesResponse로 변경되었습니다. 이는 기존 API 소비자에게 영향을 줄 수 있는 breaking change입니다.의도된 변경이라면 문제없지만, 하위 호환성이 필요한 경우 다음을 고려해 주세요:
- 새로운 엔드포인트 경로 사용 (예:
/v1/complexes/transit-v2/{complexId})- 또는 API 버전 업그레이드 (예:
/v2/complexes/transit/{complexId})src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java (1)
11-111: LGTM!DTO 구조가 잘 설계되었습니다. Record를 활용한 불변 객체,
@JsonInclude(NON_NULL)을 통한 깔끔한 JSON 출력, 그리고 Swagger 어노테이션을 통한 명확한 API 문서화가 적용되어 있습니다.StepActionenum을 통해 타입 안전성도 확보했습니다.src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java (2)
7-7: LGTM!새로운 응답 타입
TransitRoutesResponse의 import가 올바르게 추가되었습니다.
30-30: 모든complexId파라미터의 예제 값이"19413#1"로 일관되게 통일되었습니다.코드베이스 내에서 이 예제 값이 ComplexApiSpec.java(30, 42, 61줄)와 FacilityApiSpec.java(24줄) 총 4곳에 일관되게 적용되었음을 확인했습니다. 기존 예제 값들(19231#37, 19207#1)은 제거되어 일관성이 좋습니다.
다만 "19413#1"이 실제 테스트/개발 환경에 존재하는 유효한 ID인지는 데이터베이스 접근 또는 테스트 데이터 문서화를 통해 별도로 확인이 필요합니다.
| @Operation( | ||
| summary = "거리 시뮬레이터 API", | ||
| description = "임대주택 ID와 핀포인트 ID를 통해 계산을 진행합니다.") | ||
| ApiResponse<List<DistanceResponse>> distance( | ||
| @Parameter(example = "19207#1", description = "시도 간 조회") | ||
| summary = "거리 시뮬레이터 API (v2)", | ||
| description = "임대주택 ID와 핀포인트 ID를 통해 대중교통 경로 3개를 한 번에 조회합니다. 승차/하차 정보가 명확하게 표시됩니다.") | ||
| ApiResponse<TransitRoutesResponse> distance( | ||
| @Parameter(example = "19413#1", description = "시도 간 조회") | ||
| @PathVariable String complexId, | ||
| @Parameter(example = "fec9aba3-0fd9-4b75-bebf-9cb7641fd251", description = "핀포인트 ID") | ||
| @RequestParam String pinPointId) throws UnsupportedEncodingException; |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find ComplexApiSpec.java
find . -name "ComplexApiSpec.java" -type f
# Find ComplexApi implementation
find . -name "*ComplexApi*.java" -type f | grep -v target
# Search for distance method references
rg -n "distance\(" --type java | head -20
# Search for distanceV2 or getDistanceV2
rg -n "distanceV2|getDistanceV2" --type javaRepository: PinHouse/PinHouse_BE
Length of output: 2173
🏁 Script executed:
#!/bin/bash
# Read ComplexApi.java to see the actual implementation
cat -n src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ComplexApi.java | sed -n '70,85p'
# Read ComplexApiSpec.java to see the interface
cat -n src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java | sed -n '55,70p'
# Search for route count (경로 3개, 3개, route count, limit)
rg -n "3개|경로|route|limit|maxRoute" --type java src/main/java/com/pinHouse/server/platform/housing/complex/
# Check if there's a separate distance method without V2
rg -n "distance\(" src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ -B 2 -A 2Repository: PinHouse/PinHouse_BE
Length of output: 16718
🏁 Script executed:
#!/bin/bash
# Search for other distance-related endpoints or mappings
rg -n "@GetMapping|@PostMapping|@RequestMapping" src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ -B 2 -A 2
# Look for any old v1 or deprecated endpoints
rg -n "distance|v1|V1" src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ --type java
# Check if there are any other ComplexApi methods
cat -n src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ComplexApi.java | head -100Repository: PinHouse/PinHouse_BE
Length of output: 7221
🏁 Script executed:
#!/bin/bash
# Verify if TransitResponseMapper limit(3) is the only place where route count is defined
rg -n "limit.*3|3.*route|3개" src/main/java/com/pinHouse/server/platform/housing/complex/application/util/ -B 2 -A 2
# Check TransitResponseMapper to see the full context of the limit
sed -n '40,55p' src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.javaRepository: PinHouse/PinHouse_BE
Length of output: 2082
대중교통 경로 개수 설정을 하드코딩하지 마세요.
TransitResponseMapper.selectTop3() 메서드의 .limit(3) 값이 하드코딩되어 있습니다. 향후 반환 경로 수를 변경해야 할 경우를 대비해 설정 값으로 변경하세요.
예: application.yml에서 transit.max-routes: 3으로 정의하고 @Value나 @ConfigurationProperties로 주입하여 사용하면 더욱 유연합니다.
🤖 Prompt for AI Agents
In
src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java
around lines 57-64: the codebase currently hardcodes the max number of transit
routes (limit(3)) inside TransitResponseMapper.selectTop3(); replace this
hardcoded value with a configurable property (e.g., transit.max-routes) by
adding the property to application.yml and injecting it into the mapper (via
@Value or a @ConfigurationProperties bean) so selectTop3 uses the injected value
(with a sensible default if not set); update any constructors/beans to accept
the config value and adjust tests accordingly.
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 (7)
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/LineInfo.java (1)
13-23:@Schema와@JsonIgnore가 함께 사용되어 Swagger 문서와 실제 응답이 불일치합니다.
code와bgColorHex필드에@JsonIgnore를 추가하면서@Schema어노테이션은 그대로 유지되어 있습니다. 이로 인해 Swagger 문서에는 해당 필드가 표시되지만 실제 API 응답에서는 제외되어 API 소비자에게 혼란을 줄 수 있습니다.
@Schema(hidden = true)를 추가하거나@Schema어노테이션을 제거하는 것을 권장합니다:public record LineInfo( - @Schema(description = "노선 코드", example = "1") + @Schema(description = "노선 코드", example = "1", hidden = true) @JsonIgnore Integer code, @Schema(description = "노선명", example = "KTX") String label, - @Schema(description = "배경 색상 (Hex 코드)", example = "#3356B4") + @Schema(description = "배경 색상 (Hex 코드)", example = "#3356B4", hidden = true) @JsonIgnore String bgColorHex ) {src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/DistanceResponse.java (1)
100-122:@JsonIgnore어노테이션 스타일이 일관되지 않습니다.동일 클래스 내에서
@JsonIgnore(import 사용)와@com.fasterxml.jackson.annotation.JsonIgnore(fully qualified)가 혼용되고 있습니다. 일관성을 위해 한 가지 스타일로 통일하는 것이 좋습니다.@Schema(description = "통합 노선 정보 (코드, 이름, 색상)") @JsonIgnore LineInfo line, @Schema(hidden = true) - @com.fasterxml.jackson.annotation.JsonIgnore + @JsonIgnore SubwayLineType subwayLine, @Schema(hidden = true) - @com.fasterxml.jackson.annotation.JsonIgnore + @JsonIgnore BusRouteType busRouteType, // ... 나머지 필드도 동일하게 적용src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java (4)
477-485: 미사용 변수shortLabel이 있습니다.
shortenLineLabel(step.lineInfo())의 결과가shortLabel에 할당되지만 사용되지 않습니다.private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { String stopType = getStopTypeSuffix(step.type()); - String shortLabel = shortenLineLabel(step.lineInfo()); String secondaryText = step.lineInfo(); // 버스 노선 축약
506-524:createAlightStep에서도 미사용 변수shortLabel이 있습니다.
shortenLineLabel호출 결과가 사용되지 않습니다. 의도된 동작이라면 해당 라인을 제거하세요.private TransitRoutesResponse.StepResponse createAlightStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { String stopType = getStopTypeSuffix(step.type()); - String shortLabel = shortenLineLabel(step.lineInfo()); // 색상 추출 (ALIGHT는 해당 교통수단의 색상 유지)
477-477:isInferred파라미터가 사용되지 않습니다.
createBoardStep과createAlightStep메서드의isInferred파라미터가 메서드 내에서 사용되지 않습니다. 향후 사용 예정이 아니라면 제거를 권장합니다.-private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { +private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, ChipType chipType) {
599-619:formatTime메서드가 중복되며DistanceResponse.formatTime과 동작이 다릅니다.
TransitResponseMapper.formatTime:totalMinutes <= 0일 때"0분"반환DistanceResponse.formatTime:totalMinutes <= 0일 때null반환이 차이로 인해 동일한 입력값에 대해 UI에서 다른 결과가 표시될 수 있습니다.
공통 유틸리티 클래스로 추출하거나 동작을 통일하는 것을 권장합니다:
- private String formatTime(int totalMinutes) { - if (totalMinutes <= 0) { - return "0분"; - } + private String formatTime(int totalMinutes) { + if (totalMinutes <= 0) { + return null; // DistanceResponse와 동일하게 처리 + }src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java (1)
115-119:secondaryText필드의@Schema와@JsonIgnore불일치.
secondaryText필드에@JsonIgnore가 적용되어 있으나@Schema는 API 문서에 해당 필드를 표시합니다. 문서와 실제 응답의 일관성을 위해hidden = true를 추가하세요.- @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선") + @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선", hidden = true) @JsonIgnore String secondaryText,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/DistanceResponse.java(4 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java(1 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/BusRouteType.java(1 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/LineInfo.java(2 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java(2 hunks)
🔇 Additional comments (4)
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/BusRouteType.java (1)
21-34: 버스 노선 타입별 색상 값 업데이트 확인됨.기존 placeholder 색상(
#BBBBBB)에서 각 노선 타입에 맞는 실제 색상으로 변경되었습니다. 대중교통 앱에서 사용하는 표준 색상 컨벤션과 일치합니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/DistanceResponse.java (1)
139-141:TransferPointResponse.line에는@JsonIgnore가 없습니다 - 의도된 설계인지 확인 필요.
TransitResponse.line에는@JsonIgnore가 추가되었지만TransferPointResponse.line에는 추가되지 않았습니다. 두 DTO의 직렬화 동작이 다르게 의도된 것인지 확인이 필요합니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java (1)
278-298: 새 스키마 변환 로직이 잘 구현되었습니다.
toTransitRoutesResponse메서드가PathResult를 상위 3개 경로로 변환하는 로직을 깔끔하게 처리하고 있습니다. null 안전성 검사와 빈 결과 처리가 적절합니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java (1)
11-24: 새로운TransitRoutesResponseDTO 구조가 잘 설계되었습니다.다중 경로 응답을 위한 계층적 DTO 구조가 명확하게 정의되어 있습니다.
@Builder,@JsonInclude,@Schema어노테이션이 적절히 사용되었습니다.
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: 2
🧹 Nitpick comments (4)
src/main/java/com/pinHouse/server/platform/housing/complex/application/service/ComplexService.java (1)
144-167:@Transactional(readOnly = true)사용을 권장합니다.이 메서드는 조회 작업만 수행하며 데이터를 변경하지 않습니다.
getEasyDistance메서드(line 468)와 동일하게readOnly = true옵션을 사용하면 성능 최적화(dirty checking 생략, flush 방지)에 도움이 됩니다.- @Transactional + @Transactional(readOnly = true) public TransitRoutesResponse getDistanceV2(String id, String pinPointId) throws UnsupportedEncodingException {src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java (3)
474-524: 사용되지 않는 파라미터와 변수가 있습니다.
createBoardStep과createAlightStep메서드에서isInferred파라미터가 사용되지 않습니다.- 두 메서드 모두
shortLabel변수가 할당만 되고 사용되지 않습니다.- private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { + private TransitRoutesResponse.StepResponse createBoardStep(RootResult.DistanceStep step, ChipType chipType) { String stopType = getStopTypeSuffix(step.type()); - String shortLabel = shortenLineLabel(step.lineInfo()); String secondaryText = step.lineInfo(); // ... } - private TransitRoutesResponse.StepResponse createAlightStep(RootResult.DistanceStep step, boolean isInferred, ChipType chipType) { + private TransitRoutesResponse.StepResponse createAlightStep(RootResult.DistanceStep step, ChipType chipType) { String stopType = getStopTypeSuffix(step.type()); - String shortLabel = shortenLineLabel(step.lineInfo()); // ... }호출부(Lines 407, 412)도 함께 업데이트해야 합니다.
543-563: 인덱스 재할당 시 불필요한 객체 생성이 발생합니다.현재 구현에서는
stepIndex만 변경하기 위해 모든 필드를 복사하여 새 객체를 생성합니다. 대안으로createXxxStep메서드들에서 처음부터 올바른 인덱스를 전달하거나,AtomicInteger를 사용하여 생성 시점에 인덱스를 부여하는 방식을 고려해 볼 수 있습니다.
577-583: 불필요한 문자열 치환이 있습니다.
.replace("호선", "호선")은 동일한 문자열로 치환하므로 아무 효과가 없습니다.private String shortenLineLabel(String label) { if (label == null) return null; - return label.replace("수도권 ", "").replace("호선", "호선"); + return label.replace("수도권 ", ""); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java(1 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/service/ComplexService.java(2 hunks)src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java(2 hunks)
🔇 Additional comments (6)
src/main/java/com/pinHouse/server/platform/housing/complex/application/service/ComplexService.java (1)
111-141: LGTM!변수명 변경(
segments→distance) 및 주석 업데이트가 명확하게 반영되었습니다.src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java (3)
270-298: LGTM!
toTransitRoutesResponse메서드가 null 및 빈 입력에 대한 방어 로직을 적절히 처리하고 있습니다.
300-341: LGTM!경로 요약 정보 생성 및 환승 횟수 계산 로직이 정확합니다.
368-436: LGTM!DEPART, WALK, BOARD, ALIGHT, ARRIVE 단계를 생성하는 로직이 잘 구현되어 있습니다. 경계 조건(WALK만 있는 경우, 0분 구간 필터링)도 적절히 처리됩니다.
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java (2)
1-24: LGTM!TransitRoutesResponse DTO 구조가 잘 설계되었습니다.
@Builder,@JsonInclude(NON_NULL),@Schema어노테이션이 적절히 적용되어 있습니다.
47-141: LGTM!
SummaryResponse,SegmentResponse,StepActionenum이 명확하게 정의되어 있습니다.
| @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선") | ||
| @JsonIgnore | ||
| String secondaryText, |
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.
@JsonIgnore와 @Schema가 동시에 적용되어 있습니다.
secondaryText 필드에 @JsonIgnore가 적용되어 직렬화되지 않지만, @Schema로 Swagger 문서에는 표시됩니다. 이는 API 문서와 실제 응답 간 불일치를 유발합니다.
의도적으로 클라이언트에 노출하지 않으려면 @Schema(hidden = true)를 사용하거나, 노출해야 한다면 @JsonIgnore를 제거하세요.
@Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선")
- @JsonIgnore
String secondaryText,또는 문서에서도 숨기려면:
- @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선")
- @JsonIgnore
+ @Schema(hidden = true)
String secondaryText,📝 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.
| @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선") | |
| @JsonIgnore | |
| String secondaryText, | |
| @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선") | |
| String secondaryText, |
| @Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선") | |
| @JsonIgnore | |
| String secondaryText, | |
| @Schema(hidden = true) | |
| String secondaryText, |
🤖 Prompt for AI Agents
In
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java
around lines 116-118, the field secondaryText is annotated with both @JsonIgnore
and @Schema which causes a mismatch between runtime JSON and Swagger docs;
decide whether the field should be hidden or exposed and then make them
consistent: if it must be excluded from responses keep @JsonIgnore and change
@Schema to @Schema(hidden = true); if it must be returned to clients remove
@JsonIgnore and keep the @Schema annotation (or update examples/description as
needed); ensure imports are adjusted and run codegen/swagger build to verify
docs match the API.
| /** | ||
| * Segments 생성 (색 막대용) | ||
| */ | ||
| private List<TransitRoutesResponse.SegmentResponse> toSegmentResponses(RootResult route) { | ||
| if (route == null || route.steps() == null) { | ||
| return List.of(); | ||
| } | ||
|
|
||
| return route.steps().stream() | ||
| .filter(step -> step.time() > 0) // 0분인 구간은 제외 | ||
| .map(step -> { | ||
| ChipType type = mapType(step.type()); | ||
| String bgColorHex = extractBgColorHex(step, type); | ||
|
|
||
| return TransitRoutesResponse.SegmentResponse.builder() | ||
| .type(step.type().name()) | ||
| .minutes(step.time()) | ||
| .minutesText(formatMinutes(step.time())) | ||
| .colorHex(bgColorHex) | ||
| .line(step.line()) | ||
| .build(); | ||
| }) | ||
| .toList(); | ||
| } |
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.
step.type()가 null인 경우 NPE 발생 가능성이 있습니다.
Line 358에서 step.type().name()을 직접 호출하고 있는데, mapType 메서드에서는 null 타입을 WALK로 처리하는 것과 달리 여기서는 null 체크가 없습니다.
return TransitRoutesResponse.SegmentResponse.builder()
- .type(step.type().name())
+ .type(step.type() != null ? step.type().name() : "WALK")
.minutes(step.time())📝 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.
| /** | |
| * Segments 생성 (색 막대용) | |
| */ | |
| private List<TransitRoutesResponse.SegmentResponse> toSegmentResponses(RootResult route) { | |
| if (route == null || route.steps() == null) { | |
| return List.of(); | |
| } | |
| return route.steps().stream() | |
| .filter(step -> step.time() > 0) // 0분인 구간은 제외 | |
| .map(step -> { | |
| ChipType type = mapType(step.type()); | |
| String bgColorHex = extractBgColorHex(step, type); | |
| return TransitRoutesResponse.SegmentResponse.builder() | |
| .type(step.type().name()) | |
| .minutes(step.time()) | |
| .minutesText(formatMinutes(step.time())) | |
| .colorHex(bgColorHex) | |
| .line(step.line()) | |
| .build(); | |
| }) | |
| .toList(); | |
| } | |
| /** | |
| * Segments 생성 (색 막대용) | |
| */ | |
| private List<TransitRoutesResponse.SegmentResponse> toSegmentResponses(RootResult route) { | |
| if (route == null || route.steps() == null) { | |
| return List.of(); | |
| } | |
| return route.steps().stream() | |
| .filter(step -> step.time() > 0) // 0분인 구간은 제외 | |
| .map(step -> { | |
| ChipType type = mapType(step.type()); | |
| String bgColorHex = extractBgColorHex(step, type); | |
| return TransitRoutesResponse.SegmentResponse.builder() | |
| .type(step.type() != null ? step.type().name() : "WALK") | |
| .minutes(step.time()) | |
| .minutesText(formatMinutes(step.time())) | |
| .colorHex(bgColorHex) | |
| .line(step.line()) | |
| .build(); | |
| }) | |
| .toList(); | |
| } |
🤖 Prompt for AI Agents
In
src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java
around lines 343 to 366, avoid potential NPE by not calling step.type().name()
directly; use the already-mapped non-null ChipType (type = mapType(step.type()))
when setting the response type (e.g., .type(type.name())), and ensure any other
usages in this block that assume step.type() non-null are updated to use the
safe 'type' variable so null step.type() is treated as WALK consistently.
📌 작업한 내용
🔍 참고 사항
🖼️ 스크린샷
🔗 관련 이슈
✅ 체크리스트
Summary by CodeRabbit
New Features
Documentation
Bug Fixes / Data
✏️ Tip: You can customize this high-level summary in your review settings.