FlightSearchController

국제 항공편 검색 API를 제공하는 컨트롤러. 편도/왕복/다구간 검색 키 생성 및 검색 결과 조회 기능을 담당한다.

의존성

서비스용도
FlightSearchService검색 결과 조회
StandardFlightSearchUseCase검색 초기화
AirlineService항공사 정보 조회
AirportService공항 정보 조회
LocationService위치 정보 조회
BookableDateService예약 가능 날짜 범위
BillingService빌링 서비스

메서드

searchOneWayTripFlightsListKey

fun searchOneWayTripFlightsListKey(
    originType: LocationType,
    origin: String,
    destinationType: LocationType,
    destination: String,
    outboundDate: LocalDate,
    cabins: Set<CabinType>,
    adult: Int,
    child: Int = 0,
    infant: Int = 0,
    freeBaggageOnly: Boolean = false,
    useCache: Boolean = true
): Map<String, UUID>

편도 항공편 검색 키를 생성한다.

CallerCallee
HTTP GET /flights/search/{originType}:{origin}-{destinationType}:{destination}/{outboundDate}FlightSearchController.searchFlightsListKey

searchRoundTripFlightsListKey

fun searchRoundTripFlightsListKey(
    originType: LocationType,
    origin: String,
    destinationType: LocationType,
    destination: String,
    outboundDate: LocalDate,
    inboundDate: LocalDate,
    cabins: Set<CabinType>,
    adult: Int,
    child: Int = 0,
    infant: Int = 0,
    freeBaggageOnly: Boolean = false,
    useCache: Boolean = true
): Map<String, UUID>

왕복 항공편 검색 키를 생성한다.

CallerCallee
HTTP GET /flights/search/{...}/{outboundDate}/{inboundDate}FlightSearchController.searchFlightsListKey

searchMultiCityTripFlightsListKey (2~4구간)

다구간(2~4구간) 항공편 검색 키를 생성한다. 구간 수에 따라 오버로딩된 메서드가 존재한다.

CallerCallee
HTTP GET /flights/search/{...}/{date1}/{...}/{date2}/...FlightSearchController.searchFlightsListKey

searchFlightsListKey (private)

private fun searchFlightsListKey(
    adult: Int,
    child: Int,
    infant: Int,
    freeBaggageOnly: Boolean,
    cabins: Set<CabinType>,
    useCache: Boolean,
    vararg originDestinationLocationInfo: OriginDestinationLocationInfo
): Map<String, UUID>

실제 검색 키 생성 로직. SearchInfo를 생성하고 유효성 검사 후 UseCase를 호출한다.


getFlights

fun getFlights(
    listKey: UUID,
    request: FlightSearchRequest
): ResponseEntity<FlightSearchPageView>

검색 키로 항공편 검색 결과를 조회한다. 폴링 방식으로 PENDING/ERROR/완료 상태에 따라 다른 응답을 반환한다.


getCacheKeyStatus

fun getCacheKeyStatus(listKey: UUID): Map<String, String>

캐시 키 유효성을 확인한다.

CallerCallee
HTTP GET /flights/{listKey}/statusFlightSearchService.existFlightSearch