Untitled
unknown
plain_text
a year ago
1.1 kB
4
Indexable
@Operation(summary = "Find all routes according to the params") @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<List<RouteDto>> getRoutes(@PathVariable String tenantId, @RequestParam("airportCode") Optional<AirportCode> airportCode, @RequestParam("cityCode") Optional<CityCode> cityCode, @RequestParam("countryCode") Optional<CountryCode> countryCode) { if (airportCode.isPresent()){ return ResponseEntity.ok(routeService.getRoutesByAirportCode(tenantId, airportCode.get())); } else if (cityCode.isPresent()){ return ResponseEntity.ok(routeService.getRoutesByCityCode(tenantId, cityCode.get())); } else if (countryCode.isPresent()){ return ResponseEntity.ok(routeService.getRoutesByCountryCode(tenantId, countryCode.get())); }else{ return ResponseEntity.ok(routeService.getRoutes(tenantId)); } }
Editor is loading...
Leave a Comment