Adds various team endpoints
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package net.halfbinary.scavengerhuntapi.model
|
||||
|
||||
enum class FoundStatus {
|
||||
NOT_FOUND,
|
||||
SUBMITTED,
|
||||
APPROVED,
|
||||
REJECTED,
|
||||
|
||||
@@ -7,4 +7,6 @@ typealias HuntId = UUID
|
||||
typealias HunterId = UUID
|
||||
typealias ItemId = UUID
|
||||
typealias TeamId = UUID
|
||||
typealias RefreshId = UUID
|
||||
typealias RefreshId = UUID
|
||||
typealias TeamHuntId = UUID
|
||||
typealias PhotoId = UUID
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.converter
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.Team
|
||||
import net.halfbinary.scavengerhuntapi.model.domain.TeamHunt
|
||||
import net.halfbinary.scavengerhuntapi.model.record.TeamHuntRecord
|
||||
import net.halfbinary.scavengerhuntapi.model.record.TeamRecord
|
||||
import net.halfbinary.scavengerhuntapi.model.request.TeamRequest
|
||||
import net.halfbinary.scavengerhuntapi.model.response.TeamResponse
|
||||
|
||||
fun TeamHunt.toRecord(): TeamHuntRecord {
|
||||
return TeamHuntRecord(id, teamId, huntId)
|
||||
}
|
||||
|
||||
fun TeamHuntRecord.toDomain(): TeamHunt {
|
||||
return TeamHunt(id, teamId, huntId)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.domain
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.HuntId
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamHuntId
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamId
|
||||
import java.util.UUID
|
||||
|
||||
data class TeamHunt(
|
||||
val id: TeamHuntId = TeamHuntId.randomUUID(),
|
||||
val teamId: TeamId,
|
||||
val huntId: HuntId
|
||||
)
|
||||
@@ -4,6 +4,7 @@ import jakarta.persistence.Entity
|
||||
import jakarta.persistence.Id
|
||||
import jakarta.persistence.Table
|
||||
import net.halfbinary.scavengerhuntapi.model.HuntId
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamHuntId
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamId
|
||||
import java.util.*
|
||||
|
||||
@@ -11,7 +12,7 @@ import java.util.*
|
||||
@Table(name = "team_hunt")
|
||||
data class TeamHuntRecord(
|
||||
@Id
|
||||
val id: UUID,
|
||||
val id: TeamHuntId,
|
||||
val teamId: TeamId,
|
||||
val huntId: HuntId
|
||||
)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.request
|
||||
|
||||
import jakarta.validation.constraints.NotBlank
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamId
|
||||
|
||||
data class JoinTeamRequest(
|
||||
@field:NotBlank
|
||||
val teamId: TeamId
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.response
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.PhotoId
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class PhotoResponse(
|
||||
val id: PhotoId,
|
||||
val hunterName: String,
|
||||
val photoUploadDateTime: LocalDateTime
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.halfbinary.scavengerhuntapi.model.response
|
||||
|
||||
import net.halfbinary.scavengerhuntapi.model.FoundStatus
|
||||
import net.halfbinary.scavengerhuntapi.model.ItemId
|
||||
|
||||
data class TeamItemResponse(
|
||||
val id: ItemId,
|
||||
val itemName: String,
|
||||
val hunterName: String,
|
||||
val itemFoundStatus: FoundStatus
|
||||
)
|
||||
Reference in New Issue
Block a user