35 lines
1.0 KiB
Kotlin
35 lines
1.0 KiB
Kotlin
package space.luminic.budgerapp.controllers
|
|
|
|
import org.slf4j.LoggerFactory
|
|
import org.springframework.http.ResponseEntity
|
|
import org.springframework.web.bind.annotation.GetMapping
|
|
import org.springframework.web.bind.annotation.PathVariable
|
|
import org.springframework.web.bind.annotation.RequestMapping
|
|
import org.springframework.web.bind.annotation.RestController
|
|
import reactor.core.publisher.Mono
|
|
import space.luminic.budgerapp.models.User
|
|
import space.luminic.budgerapp.services.UserService
|
|
|
|
|
|
@RestController
|
|
@RequestMapping("/users")
|
|
class UsersController(val userService: UserService) {
|
|
|
|
val logger = LoggerFactory.getLogger(javaClass)
|
|
|
|
@GetMapping("/{id}")
|
|
fun getUser(@PathVariable id: String): Mono<User> {
|
|
return userService.getById(id)
|
|
}
|
|
|
|
@GetMapping("/")
|
|
fun getUsers(): Mono<List<User>> {
|
|
// return ResponseEntity.ok("teset")
|
|
return userService.getUsers()
|
|
}
|
|
//
|
|
// @GetMapping("/regen")
|
|
// fun regenUsers(): ResponseEntity<Any> {
|
|
// return ResponseEntity.ok(userService.regenPass())
|
|
// }
|
|
} |