Skip to content

Commit

Permalink
Merge pull request #73 from tukcomCD2024/backend/feature/67-amadeus-h…
Browse files Browse the repository at this point in the history
…otel

[hotfix] getFlightOffers API Method POST로 수정
  • Loading branch information
Dayon-Hong authored May 13, 2024
2 parents 03bf595 + 003bf73 commit bf75983
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.isp.backend.domain.flight.dto.response.FlightLikeResponse;
import com.isp.backend.domain.flight.service.FlightOfferService;
import com.isp.backend.domain.flight.dto.request.FlightSearchRequest;
import com.isp.backend.global.exception.flight.FlightSearchFailedException;
import com.isp.backend.global.exception.flight.AmadeusSearchFailedException;
import com.isp.backend.global.exception.flight.SkyScannerGenerateFailedException;
import com.isp.backend.global.security.CustomUserDetails;
import lombok.RequiredArgsConstructor;
Expand All @@ -27,15 +27,15 @@ public class FlightOfferController {
private FlightOfferService flightOfferService;

/** 항공권 검색 API **/
@GetMapping("/search")
@PostMapping("/search")
public ResponseEntity<String> getFlightOffers(@AuthenticationPrincipal CustomUserDetails customUserDetails,
@RequestBody FlightSearchRequest request) {
String memberUid = customUserDetails.getUsername();
try {
String flightOffersJson = flightOfferService.getFlightOffers(request);
return ResponseEntity.ok(flightOffersJson);
} catch (ResponseException e) {
throw new FlightSearchFailedException();
throw new AmadeusSearchFailedException();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.isp.backend.domain.gpt.entity.GptSchedule;
import com.isp.backend.domain.gpt.entity.GptScheduleParser;
import com.isp.backend.domain.schedule.service.ScheduleService;
import com.isp.backend.global.s3.service.S3ImageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public enum ErrorCode {
IMAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "S004", "이미지를 찾을 수 없습니다."),
IATA_CODE_NOT_FOUND(HttpStatus.NOT_FOUND, "S005", "해당 국가의 공항 코드를 찾을 수 없습니다."),

// Flight
FLIGHT_SEARCH_FAILED(HttpStatus.INTERNAL_SERVER_ERROR,"F001", "힝공편 조회를 가져오는 중 오류를 발생했습니다."),
// Flight & Hotel
AMADEUS_SEARCH_FAILED(HttpStatus.INTERNAL_SERVER_ERROR,"F001", "아마데우스 요청을 가져오는 중 오류를 발생했습니다."),
SKY_SCANNER_GENERATE_FAILED(HttpStatus.INTERNAL_SERVER_ERROR,"F002", "스카이스캐너 URL을 생성할 수 없습니다."),
FLIGHT_NOT_FOUND(HttpStatus.NOT_FOUND, "F003", "해당 id의 항공권을 찾을 수 없습니다."),
NOT_YOUR_FLIGHT(HttpStatus.UNAUTHORIZED, "F004", "사용자의 항공권이 아닙니다");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.isp.backend.global.exception.CustomException;
import com.isp.backend.global.exception.ErrorCode;

public class FlightSearchFailedException extends CustomException {
public class AmadeusSearchFailedException extends CustomException {

public FlightSearchFailedException() {
super(ErrorCode.FLIGHT_SEARCH_FAILED);
public AmadeusSearchFailedException() {
super(ErrorCode.AMADEUS_SEARCH_FAILED);
}

}

0 comments on commit bf75983

Please sign in to comment.