Skip to content

Commit

Permalink
#20 - Feat: Add Car Navigation controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
eun61n00 committed Aug 18, 2023
1 parent 465f797 commit 26237e4
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package org.routemaster.api.total.domain.navigation.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.routemaster.api.total.domain.navigation.data.CarNavigationRoutes;
import org.routemaster.api.total.domain.navigation.service.CarNavigationService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@Slf4j
@RestController
@RequestMapping("/navigation")
@RequiredArgsConstructor
public class CarNavigationRestController {

private final CarNavigationService carNavigationService;

@GetMapping("/car")
public ResponseEntity<Mono<CarNavigationRoutes>> navigate(
@RequestParam Double originLatitude,
@RequestParam Double originLongitude,
@RequestParam Double destinationLatitude,
@RequestParam Double destinationLogitude,
@RequestParam(required = false) String priority,
@RequestParam(required = false) String avoid,
@RequestParam(required = false) Boolean alternatives,
@RequestParam(required = false) Boolean roadDetails,
@RequestParam(required = false) Integer carType,
@RequestParam(required = false) String carFuel,
@RequestParam(required = false) Boolean carHipass,
@RequestParam(required = false) Boolean summary
) {
return ResponseEntity.ok(
carNavigationService.navigate(
originLatitude,
originLongitude,
destinationLatitude,
destinationLogitude,
priority,
avoid,
alternatives,
roadDetails,
carType,
carFuel,
carHipass,
summary
));
}
}

0 comments on commit 26237e4

Please sign in to comment.