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>
This commit was merged in pull request #1.
This commit is contained in:
@@ -3,6 +3,7 @@ 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(
|
||||
@@ -15,4 +16,12 @@ fun HunterSignupRequest.toDomain(): Hunter {
|
||||
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.converter
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.Login
|
||||
import net.halfbinary.scavengerhuntapi.model.request.LoginRequest
|
||||
|
||||
fun LoginRequest.toDomain(): Login {
|
||||
return Login(email, password)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.domain
|
||||
|
||||
data class Login(
|
||||
val email: String,
|
||||
val password: String
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.request
|
||||
|
||||
data class LoginRequest(
|
||||
val email: String,
|
||||
val password: String
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.response
|
||||
|
||||
data class LoginResponse(
|
||||
val email: String,
|
||||
val name: String
|
||||
)
|
||||
Reference in New Issue
Block a user