Removes redundant DB data fields and adds photo submission endpoint along with MinIO support for image storage

This commit is contained in:
2026-05-14 00:38:44 -05:00
parent 863c824421
commit 5ca7a685dd
15 changed files with 208 additions and 25 deletions

View File

@@ -0,0 +1,8 @@
package net.halfbinary.scavengerhuntapi.model
enum class PhotoStatus {
SUBMITTED,
APPROVED,
REJECTED,
REMOVED
}

View File

@@ -2,7 +2,6 @@ package net.halfbinary.scavengerhuntapi.model
import java.util.*
typealias FoundId = UUID
typealias HuntId = UUID
typealias HunterId = UUID
typealias ItemId = UUID

View File

@@ -0,0 +1,23 @@
package net.halfbinary.scavengerhuntapi.model.converter
import net.halfbinary.scavengerhuntapi.model.domain.Photo
import net.halfbinary.scavengerhuntapi.model.record.PhotoRecord
import net.halfbinary.scavengerhuntapi.model.response.PhotoResponse
fun Photo.toRecord() = PhotoRecord(
id = id,
itemId = itemId,
huntId = huntId,
hunterId = hunterId,
foundDateTime = foundDateTime,
status = status,
statusChangeDateTime = statusChangeDateTime
)
fun Photo.toResponse() = PhotoResponse(
id = id,
hunterId = hunterId,
photoUploadDateTime = foundDateTime,
photoStatus = status,
photoStatusChangeDateTime = statusChangeDateTime
)

View File

@@ -0,0 +1,19 @@
package net.halfbinary.scavengerhuntapi.model.domain
import net.halfbinary.scavengerhuntapi.model.HuntId
import net.halfbinary.scavengerhuntapi.model.HunterId
import net.halfbinary.scavengerhuntapi.model.ItemId
import net.halfbinary.scavengerhuntapi.model.PhotoId
import net.halfbinary.scavengerhuntapi.model.PhotoStatus
import java.time.LocalDateTime
import java.util.UUID
data class Photo(
val id: PhotoId = UUID.randomUUID(),
val itemId: ItemId,
val huntId: HuntId,
val hunterId: HunterId,
val foundDateTime: LocalDateTime,
val status: PhotoStatus,
val statusChangeDateTime: LocalDateTime
)

View File

@@ -3,25 +3,25 @@ package net.halfbinary.scavengerhuntapi.model.record
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import net.halfbinary.scavengerhuntapi.model.FoundId
import net.halfbinary.scavengerhuntapi.model.FoundStatus
import net.halfbinary.scavengerhuntapi.model.HuntId
import net.halfbinary.scavengerhuntapi.model.HunterId
import net.halfbinary.scavengerhuntapi.model.ItemId
import net.halfbinary.scavengerhuntapi.model.PhotoId
import net.halfbinary.scavengerhuntapi.model.PhotoStatus
import java.time.LocalDateTime
/**
* Represents a found Item for a Hunt by a Hunter
*/
@Entity
@Table(name = "found")
data class FoundRecord(
@Table(name = "photo")
data class PhotoRecord(
@Id
val id: FoundId,
val id: PhotoId,
val itemId: ItemId,
val huntId: HuntId,
val hunterId: HunterId,
val foundDateTime: LocalDateTime,
val imageName: String,
val status: FoundStatus
val status: PhotoStatus,
val statusChangeDateTime: LocalDateTime,
)

View File

@@ -1,10 +1,14 @@
package net.halfbinary.scavengerhuntapi.model.response
import net.halfbinary.scavengerhuntapi.model.HunterId
import net.halfbinary.scavengerhuntapi.model.PhotoId
import net.halfbinary.scavengerhuntapi.model.PhotoStatus
import java.time.LocalDateTime
data class PhotoResponse(
val id: PhotoId,
val hunterName: String,
val photoUploadDateTime: LocalDateTime
val hunterId: HunterId,
val photoUploadDateTime: LocalDateTime,
val photoStatus: PhotoStatus,
val photoStatusChangeDateTime: LocalDateTime,
)

View File

@@ -2,10 +2,11 @@ package net.halfbinary.scavengerhuntapi.model.response
import net.halfbinary.scavengerhuntapi.model.FoundStatus
import net.halfbinary.scavengerhuntapi.model.ItemId
import java.time.LocalDateTime
data class TeamItemResponse(
val id: ItemId,
val itemName: String,
val hunterName: String,
val itemFoundStatus: FoundStatus
val hunterName: String?,
val itemFoundStatus: FoundStatus,
val itemStatusChangeDateTime: LocalDateTime,
)