1 | package mk.ukim.finki.busngobackend.api
|
---|
2 |
|
---|
3 | import mk.ukim.finki.busngobackend.service.AdminService
|
---|
4 | import org.springframework.web.bind.annotation.*
|
---|
5 |
|
---|
6 | @RestController
|
---|
7 | @RequestMapping("/api/admin")
|
---|
8 | class AdminController(
|
---|
9 | private val adminService: AdminService,
|
---|
10 | ) {
|
---|
11 | @GetMapping("/average-time-between-stations")
|
---|
12 | fun getAvgTimeBetweenStations() = adminService.getAverageTimeBetweenStations()
|
---|
13 |
|
---|
14 | @GetMapping("/fines-by-line")
|
---|
15 | fun getFinesByLine() = adminService.getFinesByLine()
|
---|
16 |
|
---|
17 | @GetMapping("/commutes-by-hour")
|
---|
18 | fun getCommutesByHour() = adminService.getCommutesByHour()
|
---|
19 |
|
---|
20 | @GetMapping("/commutes-by-line")
|
---|
21 | fun getCommutesByLine() = adminService.getCommutesByLine()
|
---|
22 |
|
---|
23 | @GetMapping("/number-of-passengers-per-line-and-station")
|
---|
24 | fun getNumberOfPassengersPerLineAndStation() = adminService.getNumberOfPassengersByLineAndStation()
|
---|
25 |
|
---|
26 | @GetMapping("/ticket-sales")
|
---|
27 | fun getTicketSales() = adminService.getTicketSales()
|
---|
28 |
|
---|
29 | @GetMapping("/total-income")
|
---|
30 | fun getTotalIncome() = adminService.getTotalIncome()
|
---|
31 |
|
---|
32 | @GetMapping("/all-users")
|
---|
33 | fun getAllUsers() = adminService.getAllUsers()
|
---|
34 |
|
---|
35 | @PostMapping("/update-roles/{id}")
|
---|
36 | fun updateRolesForUser(
|
---|
37 | @PathVariable id: Long,
|
---|
38 | @RequestBody roles: List<String>,
|
---|
39 | ) = adminService.updateRolesForUser(id, roles)
|
---|
40 | }
|
---|