source: bus-n-go-pavel-216049/bus-n-go-backend/src/main/kotlin/mk/ukim/finki/busngobackend/api/RouteInstanceController.kt

Last change on this file was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 4 weeks ago

split group project and individual project into two separate folders

  • Property mode set to 100644
File size: 982 bytes
Line 
1package mk.ukim.finki.busngobackend.api
2
3import mk.ukim.finki.busngobackend.api.requests.StartRouteInstanceRequest
4import mk.ukim.finki.busngobackend.service.RouteInstanceService
5import org.springframework.web.bind.annotation.*
6
7@RestController
8@RequestMapping("/api/route-instances")
9class RouteInstanceController(
10 private val routeInstanceService: RouteInstanceService,
11) {
12 @PostMapping("/start")
13 fun start(
14 @RequestBody request: StartRouteInstanceRequest,
15 ) = routeInstanceService.start(request)
16
17 @PatchMapping("/stop")
18 fun stop(
19 @RequestBody id: Long,
20 ) = routeInstanceService.stop(id)
21
22 @GetMapping("/{id}")
23 fun getById(
24 @PathVariable id: Long,
25 ) = this.routeInstanceService.getById(id)
26
27 @GetMapping("/station/{stationId}")
28 fun getForStation(
29 @PathVariable stationId: Long,
30 ) = routeInstanceService.getForStation(stationId)
31
32 @GetMapping()
33 fun getAll() = routeInstanceService.getAll()
34}
Note: See TracBrowser for help on using the repository browser.