Reviewed-on: #1 Co-authored-by: aarbit <aarbit@gmail.com> Co-committed-by: aarbit <aarbit@gmail.com>
27 lines
774 B
Kotlin
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)
|
|
} |