Last change
on this file was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 3 months ago |
split group project and individual project into two separate folders
|
-
Property mode
set to
100644
|
File size:
971 bytes
|
Line | |
---|
1 | package mk.ukim.finki.busngobackend.api
|
---|
2 |
|
---|
3 | import mk.ukim.finki.busngobackend.service.DirectionService
|
---|
4 | import mk.ukim.finki.busngobackend.service.LineService
|
---|
5 | import mk.ukim.finki.busngobackend.service.StationService
|
---|
6 | import org.springframework.web.bind.annotation.*
|
---|
7 |
|
---|
8 | @RestController
|
---|
9 | @RequestMapping("/api/lines")
|
---|
10 | class LineController(
|
---|
11 | private val lineService: LineService,
|
---|
12 | private val directionService: DirectionService,
|
---|
13 | private val stationService: StationService,
|
---|
14 | ) {
|
---|
15 | @GetMapping("")
|
---|
16 | fun getLines() = lineService.findAllLines()
|
---|
17 |
|
---|
18 | @GetMapping("/{id}/directions")
|
---|
19 | fun getLineDirections(
|
---|
20 | @PathVariable("id") lineId: Int,
|
---|
21 | ) = directionService.findDirectionsByLineId(lineId)
|
---|
22 |
|
---|
23 | @GetMapping("/{lineId}/stations")
|
---|
24 | fun getLineStations(
|
---|
25 | @PathVariable("lineId") lineId: Int,
|
---|
26 | @RequestParam("directionId", required = false) directionId: Long,
|
---|
27 | ) = stationService.findStationsByLineIdAndDirectionId(lineId, directionId)
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.