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>편도 항공편 검색 키를 생성한다.
| Caller | Callee |
|---|---|
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>왕복 항공편 검색 키를 생성한다.
| Caller | Callee |
|---|---|
HTTP GET /flights/search/{...}/{outboundDate}/{inboundDate} | FlightSearchController.searchFlightsListKey |
searchMultiCityTripFlightsListKey (2~4구간)
다구간(2~4구간) 항공편 검색 키를 생성한다. 구간 수에 따라 오버로딩된 메서드가 존재한다.
| Caller | Callee |
|---|---|
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/완료 상태에 따라 다른 응답을 반환한다.
| Caller | Callee |
|---|---|
HTTP POST /flights/{listKey} | FlightSearchService.getFlightSearch |
| FlightSearchPageView.ofPending | |
| FlightSearchPageView.ofComplete | |
| AirlineService.getAirlinesMap | |
| AirportService.getAirportsMap |
getCacheKeyStatus
fun getCacheKeyStatus(listKey: UUID): Map<String, String>캐시 키 유효성을 확인한다.
| Caller | Callee |
|---|---|
HTTP GET /flights/{listKey}/status | FlightSearchService.existFlightSearch |