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

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 
1package mk.ukim.finki.busngobackend.api
2
3import mk.ukim.finki.busngobackend.api.requests.AuthRequest
4import mk.ukim.finki.busngobackend.api.requests.RegisterRequest
5import mk.ukim.finki.busngobackend.api.responses.AuthResponse
6import mk.ukim.finki.busngobackend.service.AuthService
7import org.springframework.web.bind.annotation.*
8
9@RestController
10@RequestMapping("/api/auth")
11class 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.