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:
929 bytes
|
Line | |
---|
1 | package mk.ukim.finki.busngobackend.api
|
---|
2 |
|
---|
3 | import mk.ukim.finki.busngobackend.api.requests.AuthRequest
|
---|
4 | import mk.ukim.finki.busngobackend.api.requests.RegisterRequest
|
---|
5 | import mk.ukim.finki.busngobackend.api.responses.AuthResponse
|
---|
6 | import mk.ukim.finki.busngobackend.service.AuthService
|
---|
7 | import org.springframework.web.bind.annotation.*
|
---|
8 |
|
---|
9 | @RestController
|
---|
10 | @RequestMapping("/api/auth")
|
---|
11 | class AuthController(
|
---|
12 | private val authService: AuthService,
|
---|
13 | ) {
|
---|
14 | @GetMapping()
|
---|
15 | fun isAuthenticated() = authService.isAuthenticated()
|
---|
16 |
|
---|
17 | @PostMapping("/register")
|
---|
18 | fun register(
|
---|
19 | @RequestBody registerRequest: RegisterRequest,
|
---|
20 | ): AuthResponse = authService.register(registerRequest)
|
---|
21 |
|
---|
22 | @PostMapping()
|
---|
23 | fun authenticate(
|
---|
24 | @RequestBody authRequest: AuthRequest,
|
---|
25 | ): AuthResponse = authService.authenticate(authRequest)
|
---|
26 |
|
---|
27 | @GetMapping("/is-driver-free")
|
---|
28 | fun isDriverFree() = this.authService.isDriverFree()
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.