Files
scavengerhunt-api/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/SignupController.kt

19 lines
817 B
Kotlin

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
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
@RestController
class SignupController(private val signupService: SignupService) {
@PostMapping("/signup")
fun hunterSignup(@Valid @RequestBody body: HunterSignupRequest): ResponseEntity<Any> {
signupService.createNewHunter(body.toDomain())
return ResponseEntity.ok().build()
}
}