22 lines
805 B
Kotlin
22 lines
805 B
Kotlin
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)
|
|
} |