Implements Hunt basic create and get, and adds field validation to controllers

This commit is contained in:
2025-12-22 08:44:14 -06:00
parent 04b61485ea
commit 5905882763
16 changed files with 230 additions and 5 deletions

View File

@@ -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)
}