Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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.RootResult;
import com.pinHouse.server.platform.housing.complex.application.dto.result.SubwayLineType;
Expand Down Expand Up @@ -97,6 +98,7 @@ public record TransitResponse(
String lineText,

@Schema(description = "통합 노선 정보 (코드, 이름, 색상)")
@JsonIgnore
LineInfo line,

@Schema(hidden = true)
Expand All @@ -116,6 +118,7 @@ public record TransitResponse(
ExpressBusType expressBusType,

@Schema(description = "세그먼트 배경 컬러(Hex 코드)", example = "#FF5722")
@JsonIgnore
String bgColorHex)
{ }

Expand Down Expand Up @@ -153,6 +156,7 @@ public record TransferPointResponse(
ExpressBusType expressBusType,

@Schema(description = "배경 컬러(Hex 코드)")
@JsonIgnore
String bgColorHex
) {
public enum TransferRole {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
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;
import lombok.Builder;

import java.util.List;

/**
* 대중교통 경로 응답 (3개 경로 한 번에 제공)
*/
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(name = "[응답][대중교통] 전체 경로 응답", description = "3개의 대중교통 경로를 한 번에 제공하는 응답 DTO")
public record TransitRoutesResponse(

@Schema(description = "전체 경로 개수", example = "3")
int totalCount,

@Schema(description = "경로 리스트 (최대 3개)")
List<RouteResponse> routes
) {

/**
* 개별 경로 정보
*/
@Builder
@Schema(name = "[응답][대중교통] 개별 경로", description = "하나의 대중교통 경로 정보")
public record RouteResponse(

@Schema(description = "경로 인덱스 (0부터 시작)", example = "0")
int routeIndex,

@Schema(description = "경로 요약 정보")
SummaryResponse summary,

@Schema(description = "색 막대용 구간 정보 배열")
List<SegmentResponse> distance,

@Schema(description = "세부 경로 단계 배열 (색깔 + 승차/하차 + 소요시간 모두 포함)")
List<StepResponse> steps
) {
}

/**
* 경로 요약 정보
*/
@Builder
@Schema(name = "[응답][대중교통] 경로 요약", description = "총 시간, 거리, 요금, 환승 횟수")
public record SummaryResponse(

@Schema(description = "총 소요 시간(분)", example = "83")
int totalMinutes,

@Schema(description = "총 거리(km)", example = "39.6")
double totalDistanceKm,

@Schema(description = "총 요금(원), 없으면 null", example = "1350")
Integer totalFareWon,

@Schema(description = "환승 횟수", example = "1")
int transferCount,

@Schema(description = "UI 표시용 시간 텍스트", example = "1시간 23분")
String displayText
) {
}

/**
* 색 막대용 구간 정보
*/
@Builder
@Schema(name = "[응답][대중교통] 세그먼트", description = "색 막대 렌더링용 구간 정보")
public record SegmentResponse(

@Schema(description = "이동 수단 (WALK, BUS, SUBWAY, TRAIN, AIR)", example = "SUBWAY")
String type,

@Schema(description = "소요 시간(분)", example = "65")
int minutes,

@Schema(description = "막대 위 표시 텍스트", example = "65분")
String minutesText,

@Schema(description = "구간 색상(Hex)", example = "#3356B4")
String colorHex,

@Schema(description = "노선 정보 (WALK면 null)")
LineInfo line
) {}

/**
* 세부 경로 단계 (색깔 + 승차/하차 + 시간 정보 통합)
*/
@Builder
@Schema(name = "[응답][대중교통] 단계", description = "세부 경로 단계 (색깔 + 승차/하차/도보 등 모든 정보 포함)")
public record StepResponse(

@Schema(description = "단계 인덱스 (0부터 시작)", example = "0")
int stepIndex,

@Schema(description = "행동 타입 (DEPART, WALK, BOARD, ALIGHT, ARRIVE)", example = "BOARD")
StepAction action,

@Schema(description = "이동 수단 (WALK, BUS, SUBWAY, TRAIN, AIR, null)", example = "SUBWAY")
String type,

@Schema(description = "정류장/역 이름", example = "시청역")
String stopName,

@Schema(description = "주 텍스트 (UI에 굵게 표시)", example = "시청역 승차")
String primaryText,

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


@Schema(description = "해당 구간 소요 시간(분), 없으면 null", example = "65")
Integer minutes,

@Schema(description = "색 막대용 색상(Hex), 출발/도착은 null", example = "#3356B4")
String colorHex,

@Schema(description = "노선 정보 (WALK면 null)")
LineInfo line
) {
}

/**
* 단계 행동 타입
*/
public enum StepAction {
DEPART, // 출발
WALK, // 도보
BOARD, // 승차
ALIGHT, // 하차
ARRIVE // 도착
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ public enum BusRouteType {
VILLAGE(3, "마을버스", "#86C34B"),
DIRECT_SEAT(4, "직행좌석", "#D82628"),
AIRPORT(5, "공항버스", "#F68A1E"),
TRUNK(6, "간선급행", "#BBBBBB"),
OUTER(10, "외곽", "#BBBBBB"),

TRUNK(6, "간선급행", "#E6002D"),
OUTER(10, "외곽", "#8E8E8E"),
TRUNK_LINE(11, "간선", "#0069B3"),
BRANCH(12, "지선", "#2E933C"),
CIRCULAR(13, "순환", "#F8B600"),
WIDE_AREA(14, "광역", "#D82628"),
EXPRESS(15, "급행", "#F8B600"),
TOUR(16, "관광버스", "#BBBBBB"),
RURAL(20, "농어촌버스", "#BBBBBB"),

TOUR(16, "관광버스", "#6A4FB3"),
RURAL(20, "농어촌버스", "#5B8C3B"),
GYEONGGI_INTERCITY(22, "경기도 시외형버스", "#D82628"),
EXPRESS_TRUNK(26, "급행간선", "#BBBBBB"),
HAN_RIVER(30, "한강버스", "#BBBBBB"),
EXPRESS_TRUNK(26, "급행간선", "#C8102E"),
HAN_RIVER(30, "한강버스", "#1CA9C9"),

UNKNOWN(-1, "UNKNOWN", "#BBBBBB");


private final int code;
private final String label;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pinHouse.server.platform.housing.complex.application.dto.result;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;

Expand All @@ -11,12 +12,14 @@
@Schema(name = "교통수단 노선 정보", description = "교통수단의 코드, 이름, 색상 정보")
public record LineInfo(
@Schema(description = "노선 코드", example = "1")
@JsonIgnore
Integer code,

@Schema(description = "노선명", example = "KTX")
String label,

@Schema(description = "배경 색상 (Hex 코드)", example = "#3356B4")
@JsonIgnore
String bgColorHex
) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public List<UnitTypeResponse> getComplexUnitTypes(String id, UUID userId) {



/// 대중교통 시뮬레이터
/// 대중교통 시뮬레이터 (기존 스키마)
@Override
@Transactional
public List<DistanceResponse> getDistance(String id, String pinPointId) throws UnsupportedEncodingException {
Expand All @@ -131,16 +131,41 @@ public List<DistanceResponse> getDistance(String id, String pinPointId) throws U
return rootResults.stream()
.map(route -> {
// 각 경로의 세부 구간을 TransitResponse 리스트로 매핑
List<DistanceResponse.TransitResponse> segments = mapper.from(route);
List<DistanceResponse.TransitResponse> distance = mapper.from(route);
List<DistanceResponse.TransferPointResponse> stops = mapper.extractStops(route);

// DistanceResponse 하나 생성
return DistanceResponse.from(route, segments, stops);
return DistanceResponse.from(route, distance, stops);
})
.toList();

}

/// 대중교통 시뮬레이터 (새 스키마 - 3개 경로 한 번에)
@Override
@Transactional
public TransitRoutesResponse getDistanceV2(String id, String pinPointId) throws UnsupportedEncodingException {

/// 임대주택 예외처리
ComplexDocument complex = loadComplex(id);
Location location = complex.getLocation();

/// 핀포인트 조회
PinPoint pinPoint = pinPointService.loadPinPoint(pinPointId);
Location pointLocation = pinPoint.getLocation();

/// 대중교통 목록 가져오기
PathResult pathResult = distanceUtil.findPathResult(
pointLocation.getLatitude(),
pointLocation.getLongitude(),
location.getLatitude(),
location.getLongitude()
);

/// 새 스키마로 변환 (3개 경로 한 번에)
return mapper.toTransitRoutesResponse(pathResult);
}

/// 좋아요 누른 방 목록 조회
@Override
@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.pinHouse.server.platform.housing.complex.application.dto.response.ComplexDetailResponse;
import com.pinHouse.server.platform.housing.complex.application.dto.response.DistanceResponse;
import com.pinHouse.server.platform.housing.complex.application.dto.response.TransitRoutesResponse;
import com.pinHouse.server.platform.housing.complex.application.dto.response.UnitTypeResponse;
import com.pinHouse.server.platform.housing.complex.domain.entity.ComplexDocument;
import com.pinHouse.server.platform.like.application.dto.UnityTypeLikeResponse;
Expand All @@ -25,9 +26,12 @@ public interface ComplexUseCase {
/// 상세 조회
List<UnitTypeResponse> getComplexUnitTypes(String id, UUID userId);

/// 거리 시뮬레이터 전부 조회
/// 거리 시뮬레이터 전부 조회 (기존 스키마)
List<DistanceResponse> getDistance(String id, String pinPointId) throws UnsupportedEncodingException;

/// 거리 시뮬레이터 전부 조회 (새 스키마 - 3개 경로 한 번에)
TransitRoutesResponse getDistanceV2(String id, String pinPointId) throws UnsupportedEncodingException;

/// 간편 거리 시뮬레이터 (Redis 캐싱 포함)
DistanceResponse getEasyDistance(String id, String pinPointId) throws UnsupportedEncodingException;

Expand Down
Loading
Loading