Adds stubs for some basic Team CRUD
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.converter
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.Team
|
||||
import net.halfbinary.scavengerhuntapi.model.record.TeamRecord
|
||||
import net.halfbinary.scavengerhuntapi.model.request.TeamRequest
|
||||
import net.halfbinary.scavengerhuntapi.model.response.TeamResponse
|
||||
|
||||
fun TeamRequest.toDomain(): Team {
|
||||
return Team(name = name)
|
||||
}
|
||||
|
||||
fun Team.toRecord(): TeamRecord {
|
||||
return TeamRecord(id, name)
|
||||
}
|
||||
|
||||
fun TeamRecord.toDomain(): Team {
|
||||
return Team(id, name)
|
||||
}
|
||||
|
||||
fun Team.toResponse(): TeamResponse {
|
||||
return TeamResponse(id, name)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.domain
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamId
|
||||
import java.util.UUID
|
||||
|
||||
data class Team(
|
||||
val id: TeamId = UUID.randomUUID(),
|
||||
val name: String
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.request
|
||||
|
||||
data class TeamRequest(
|
||||
val name: String
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.response
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamId
|
||||
|
||||
data class TeamResponse(
|
||||
val id: TeamId,
|
||||
val name: String
|
||||
)
|
||||
Reference in New Issue
Block a user