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:
812 bytes
|
Line | |
---|
1 | package mk.ukim.finki.busngobackend.api
|
---|
2 |
|
---|
3 | import mk.ukim.finki.busngobackend.api.requests.TicketBuyRequest
|
---|
4 | import mk.ukim.finki.busngobackend.api.responses.TicketResponse
|
---|
5 | import mk.ukim.finki.busngobackend.service.BiletService
|
---|
6 | import org.springframework.web.bind.annotation.*
|
---|
7 |
|
---|
8 | @RestController
|
---|
9 | @RequestMapping("/api/tickets")
|
---|
10 | class TicketController(
|
---|
11 | private val biletService: BiletService,
|
---|
12 | ) {
|
---|
13 | @GetMapping()
|
---|
14 | fun getTicketsByUser(): List<TicketResponse> = this.biletService.getTicketsByUser()
|
---|
15 |
|
---|
16 | @PostMapping("/buy")
|
---|
17 | fun buyTicket(
|
---|
18 | @RequestBody request: TicketBuyRequest,
|
---|
19 | ): TicketResponse = this.biletService.buyTicket(request)
|
---|
20 |
|
---|
21 | @PatchMapping("/activate/{id}")
|
---|
22 | fun activateTicket(
|
---|
23 | @PathVariable id: Long,
|
---|
24 | ): TicketResponse = this.biletService.activateTicket(id)
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.