Implements adding an item to a hunt
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.converter
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.HuntItem
|
||||
import net.halfbinary.scavengerhuntapi.model.record.HuntItemRecord
|
||||
|
||||
fun HuntItem.toRecord() = HuntItemRecord(id = id, huntId = huntId, itemId = itemId)
|
||||
|
||||
fun HuntItemRecord.toDomain() = HuntItem(id = id, huntId = huntId, itemId = itemId)
|
||||
@@ -0,0 +1,14 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.converter
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.Item
|
||||
import net.halfbinary.scavengerhuntapi.model.record.ItemRecord
|
||||
import net.halfbinary.scavengerhuntapi.model.request.ItemRequest
|
||||
import net.halfbinary.scavengerhuntapi.model.response.ItemResponse
|
||||
|
||||
fun ItemRequest.toDomain() = Item(name = name, points = points)
|
||||
|
||||
fun Item.toRecord() = ItemRecord(id = id, name = name, points = points)
|
||||
|
||||
fun ItemRecord.toDomain() = Item(id = id, name = name, points = points)
|
||||
|
||||
fun Item.toResponse() = ItemResponse(id = id, name = name, points = points)
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.domain
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.HuntId
|
||||
import net.halfbinary.scavengerhuntapi.model.ItemId
|
||||
import java.util.*
|
||||
|
||||
data class HuntItem(
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
val huntId: HuntId,
|
||||
val itemId: ItemId
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.domain
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.ItemId
|
||||
import java.util.*
|
||||
|
||||
data class Item(
|
||||
val id: ItemId = UUID.randomUUID(),
|
||||
val name: String,
|
||||
val points: Int
|
||||
)
|
||||
Reference in New Issue
Block a user