Skip to content

Conversation

@doup2001
Copy link
Member

@doup2001 doup2001 commented Dec 16, 2025

📌 작업한 내용

🔍 참고 사항

🖼️ 스크린샷

🔗 관련 이슈

✅ 체크리스트

  • 로컬에서 빌드 및 테스트 완료
  • 코드 리뷰 반영 완료
  • 문서화 필요 여부 확인

Summary by CodeRabbit

  • New Features

    • 거리 계산 API가 v2로 확장되어 최대 3개의 대중교통 경로를 한 번에 제공하며, 경로별 요약, 세그먼트 및 단계별(출발/도보/탑승/하차/도착) 정보를 포함합니다.
  • Documentation

    • API 문서와 예시 값이 새 스키마(v2) 및 다중 경로 반환을 반영하도록 업데이트되었습니다.
  • Bug Fixes / Data

    • 일부 교통 유형의 표시 색상이 조정되었고, 응답에서 내부용 필드의 노출이 제한되어 출력이 더 깔끔해졌습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Walkthrough

다중 경로 대중교통 응답 DTO TransitRoutesResponse를 추가하고, V2 서비스/유스케이스/매퍼 및 API 시그니처를 도입해 PathResult를 최대 3개 경로의 TransitRoutesResponse로 변환하도록 확장했습니다. 일부 DTO의 JSON 직렬화 노출과 Swagger 예시가 조정되었습니다.

Changes

Cohort / File(s) 변경 요약
새로운 DTO 구조
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/TransitRoutesResponse.java
다중 경로 응답 레코드 추가: TransitRoutesResponse(int totalCount, List<RouteResponse> routes) 및 중첩 레코드 RouteResponse, SummaryResponse, SegmentResponse, StepResponse, 열거형 StepAction. Lombok @Builder, Jackson @JsonInclude, Swagger @Schema 주석 포함
서비스·유스케이스 V2 추가
src/main/java/com/pinHouse/server/platform/housing/complex/application/service/ComplexService.java, src/main/java/com/pinHouse/server/platform/housing/complex/application/usecase/ComplexUseCase.java
퍼블릭 메서드 getDistanceV2(String id, String pinPointId) 추가 (유스케이스 인터페이스와 서비스 구현). 기존 getDistance는 유지되어 하위 호환성 보존
매퍼 로직 추가
src/main/java/com/pinHouse/server/platform/housing/complex/application/util/TransitResponseMapper.java
toTransitRoutesResponse(PathResult) 추가: PathResult에서 상위 3개 경로 추출, 각 경로에 대해 Summary/Segment/Step 구성, 색상 추출 및 단계 생성 헬퍼 포함한 변환 로직 구현
프레젠테이션/API 변경
src/main/java/com/pinHouse/server/platform/housing/complex/presentation/ComplexApi.java, src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java
distance 엔드포인트 반환 타입을 ApiResponse<List<DistanceResponse>>ApiResponse<TransitRoutesResponse>로 변경하고 컨트롤러가 service.getDistanceV2(...) 호출하도록 수정. Swagger 설명/예시 업데이트
직렬화(노출) 조정
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/response/DistanceResponse.java, src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/LineInfo.java
일부 필드(LineInfo.code, LineInfo.bgColorHex, TransitResponse.line, TransitResponse.bgColorHex, TransferPointResponse.bgColorHex 등)에 @JsonIgnore 추가로 JSON 노출 제한
버스 유형 색상 변경
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/BusRouteType.java
여러 BusRouteType 열거값의 colorHex 값 업데이트(예: TRUNK, OUTER, TOUR 등)
문서 예시값 업데이트
src/main/java/com/pinHouse/server/platform/housing/complex/presentation/swagger/ComplexApiSpec.java, src/main/java/com/pinHouse/server/platform/housing/facility/presentation/swagger/FacilityApiSpec.java
Swagger 파라미터 예시값을 "19231#37"/"19207#1" 등에서 "19413#1"로 갱신

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>
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • 주의 필요 영역:
    • TransitResponseMapper.java: 상위 3개 경로 선택, 단계 인덱싱/순서, 색상 추출 및 시간/문구 포맷팅의 경계조건(널/빈값, 단위 변환) 검토
    • TransitRoutesResponse 스키마와 기존 DistanceResponse 간 호환성 및 @JsonIgnore로 인한 직렬화 영향 점검
    • API 시그니처 변경에 따른 클라이언트/문서 영향 및 Swagger 예시 정확성 확인

Poem

🐰 폴짝 폴짝 길 따라가니,
세 갈래 길이 반짝 반짝,
매퍼는 색을 칠해 시간을 붙이고,
서비스는 길을 묻고 답하네,
새 DTO 위에 토끼가 작게 웃네 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning PR 제목이 실제 변경 사항과 일치하지 않습니다. 제목은 '노선도 상세 설명 수정'을 의미하지만, 실제 변경 사항은 새로운 TransitRoutesResponse DTO 구조 추가, getDistanceV2 메서드 도입, 여러 API 엔드포인트 업데이트 등 광범위한 구조적 리팩토링입니다. PR 제목을 변경 사항을 더 정확하게 반영하도록 수정하세요. 예: 'feat: 대중교통 경로 조회 API v2 스키마 추가 및 TransitRoutesResponse 도입'
Description check ⚠️ Warning PR 설명이 템플릿만 포함하고 모든 필수 섹션이 비어 있습니다. 작업 내용, 참고 사항, 관련 이슈 등 중요한 정보가 작성되지 않았으며, 체크리스트 항목들도 모두 미완료 상태입니다. PR 설명을 작성하세요: (1) '작업한 내용'에 새로운 DTO, 메서드 추가, API 변경 사항을 상세히 기술, (2) '참고 사항'에 마이그레이션 영향도 및 하위호환성 고려사항 작성, (3) 관련 이슈 번호 추가, (4) 체크리스트 항목 완료 확인 후 체크
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 93.55% which is sufficient. The required threshold is 80.00%.
✨ 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/대중교통-수정

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.

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

Test Results

22 tests  ±0   22 ✅ ±0   0s ⏱️ ±0s
 3 suites ±0    0 💤 ±0 
 3 files   ±0    0 ❌ ±0 

Results for commit a948c6f. ± Comparison against base commit 5917549.

♻️ This comment has been updated with latest results.

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

🧹 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 문이 있습니다.

JsonIgnoreLineInfo가 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5917549 and 04f90ad.

📒 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 문서화가 적용되어 있습니다. StepAction enum을 통해 타입 안전성도 확보했습니다.

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인지는 데이터베이스 접근 또는 테스트 데이터 문서화를 통해 별도로 확인이 필요합니다.

Comment on lines 57 to 64
@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;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 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 java

Repository: 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 2

Repository: 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 -100

Repository: 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.java

Repository: 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.

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 (7)
src/main/java/com/pinHouse/server/platform/housing/complex/application/dto/result/LineInfo.java (1)

13-23: @Schema@JsonIgnore가 함께 사용되어 Swagger 문서와 실제 응답이 불일치합니다.

codebgColorHex 필드에 @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 파라미터가 사용되지 않습니다.

createBoardStepcreateAlightStep 메서드의 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

📥 Commits

Reviewing files that changed from the base of the PR and between 04f90ad and fcdffc4.

📒 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: 새로운 TransitRoutesResponse DTO 구조가 잘 설계되었습니다.

다중 경로 응답을 위한 계층적 DTO 구조가 명확하게 정의되어 있습니다. @Builder, @JsonInclude, @Schema 어노테이션이 적절히 사용되었습니다.

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: 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: 사용되지 않는 파라미터와 변수가 있습니다.

  • createBoardStepcreateAlightStep 메서드에서 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

📥 Commits

Reviewing files that changed from the base of the PR and between fcdffc4 and a948c6f.

📒 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!

변수명 변경(segmentsdistance) 및 주석 업데이트가 명확하게 반영되었습니다.

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, StepAction enum이 명확하게 정의되어 있습니다.

Comment on lines +116 to +118
@Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선")
@JsonIgnore
String secondaryText,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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

Suggested change
@Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선")
@JsonIgnore
String secondaryText,
@Schema(description = "부 텍스트 (노선명, 방면 등)", example = "수도권 1호선")
String secondaryText,
Suggested change
@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.

Comment on lines +343 to +366
/**
* 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();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
/**
* 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.

@doup2001 doup2001 merged commit d5672b5 into develop Dec 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants