Files
scavengerhunt-api/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/converter/HunterConverter.kt
aarbit 04b61485ea Adds login ability, error handling, and logging (#1)
Reviewed-on: #1
Co-authored-by: aarbit <aarbit@gmail.com>
Co-committed-by: aarbit <aarbit@gmail.com>
2025-12-19 05:15:18 +00:00

27 lines
774 B
Kotlin

package net.halfbinary.scavengerhuntapi.model.converter
import net.halfbinary.scavengerhuntapi.model.domain.Hunter
import net.halfbinary.scavengerhuntapi.model.record.HunterRecord
import net.halfbinary.scavengerhuntapi.model.request.HunterSignupRequest
import net.halfbinary.scavengerhuntapi.model.response.LoginResponse
fun HunterSignupRequest.toDomain(): Hunter {
return Hunter(
email = email,
name = name,
password = password,
isAdmin = false
)
}
fun Hunter.toRecord(): HunterRecord {
return HunterRecord(id, email, name, password, isAdmin)
}
fun HunterRecord.toDomain(): Hunter {
return Hunter(id, email, name, password, isAdmin)
}
fun Hunter.toLoginResponse(): LoginResponse {
return LoginResponse(email, name)
}