Implements Hunt basic create and get, and adds field validation to controllers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package net.halfbinary.scavengerhuntapi.controller
|
||||
|
||||
import jakarta.validation.Valid
|
||||
import net.halfbinary.scavengerhuntapi.model.converter.toDomain
|
||||
import net.halfbinary.scavengerhuntapi.model.request.HunterSignupRequest
|
||||
import net.halfbinary.scavengerhuntapi.service.SignupService
|
||||
@@ -11,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController
|
||||
@RestController
|
||||
class SignupController(private val signupService: SignupService) {
|
||||
@PostMapping("/signup")
|
||||
fun hunterSignup(@RequestBody body: HunterSignupRequest): ResponseEntity<Any> {
|
||||
fun hunterSignup(@Valid @RequestBody body: HunterSignupRequest): ResponseEntity<Any> {
|
||||
signupService.createNewHunter(body.toDomain())
|
||||
return ResponseEntity.ok().build()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user