Skip to content

Commit

Permalink
Backend/feature/117 skyscanner like (#118)
Browse files Browse the repository at this point in the history
* feat : 성인, 자녀 수 컬럼 추가

* fix : 기존의 변수명을 통일하기 위해 변경

* feat : 항공권 좋아요 관련 API 에 성인, 자녀 수 추가하도록 API 수정
  • Loading branch information
Dayon-Hong authored Aug 6, 2024
1 parent 7d15f4a commit 26c8933
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ public class FlightLikeRequest {

private String transferCount;

private int adult ;

private int children ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SkyScannerRequest {

private String returnDate;

private int adults;
private int adult;

private int children;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ public class FlightLikeResponse {

private String transferCount;

private int adult ;

private int children ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ public class Flight {

private int transferCount ;

private int adult ;

private int children ;


}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public Flight toEntity(FlightLikeRequest request, Member member, Country departu
.departureIataCode(departureIataCode)
.arrivalIataCode(arrivalIataCode)
.transferCount(Integer.parseInt(request.getTransferCount()))
.adult(request.getAdult())
.children(request.getChildren())
.build();
}

Expand All @@ -45,6 +47,8 @@ public FlightLikeResponse toFlightLikeRequest(Flight flight) {
response.setDepartureIataCode(flight.getDepartureIataCode().getAirportCode());
response.setArrivalIataCode(flight.getArrivalIataCode().getAirportCode());
response.setTransferCount(String.valueOf(flight.getTransferCount()));
response.setAdult(flight.getAdult());
response.setChildren(flight.getChildren());
return response;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public String generateSkyscannerUrl(SkyScannerRequest request) {
String url = "https://www.skyscanner.co.kr/transport/flights/" +
request.getDepartureIataCode().toLowerCase() + "/" +
request.getArrivalIataCode().toLowerCase() + "/" +
departureDate + returnDate + "?adultsv2=" + request.getAdults() + childrenParam +
departureDate + returnDate + "?adultsv2=" + request.getAdult() + childrenParam +
"&departure-times=" + departureTimeMinutes +
"&inboundaltsenabled=false&outboundaltsenabled=false&ref=home&rtn=" + (returnDate.isEmpty() ? "0" : "1");

Expand Down

0 comments on commit 26c8933

Please sign in to comment.