Implements Hunt basic create and get, and adds field validation to controllers
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.converter
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.Hunt
|
||||
import net.halfbinary.scavengerhuntapi.model.record.HuntRecord
|
||||
import net.halfbinary.scavengerhuntapi.model.request.HuntCreateRequest
|
||||
import net.halfbinary.scavengerhuntapi.model.response.HuntResponse
|
||||
|
||||
fun HuntRecord.toDomain(): Hunt {
|
||||
return Hunt(id, title, startDateTime, endDateTime, isTerminated)
|
||||
}
|
||||
|
||||
fun Hunt.toResponse(): HuntResponse {
|
||||
return HuntResponse(id, title, startDateTime, endDateTime, isTerminated)
|
||||
}
|
||||
|
||||
fun HuntCreateRequest.toDomain(): Hunt {
|
||||
return Hunt(title = title, startDateTime = startDateTime, endDateTime = endDateTime, isTerminated = false)
|
||||
}
|
||||
|
||||
fun Hunt.toRecord(): HuntRecord {
|
||||
return HuntRecord(id, title, startDateTime, endDateTime, isTerminated)
|
||||
}
|
||||
Reference in New Issue
Block a user