Adds/collects Hunter endpoints and cleans up the code a bit

This commit is contained in:
2026-05-12 23:54:27 -05:00
parent 4a1077833e
commit b2ba9ce676
17 changed files with 115 additions and 60 deletions

View File

@@ -3,20 +3,17 @@ package net.halfbinary.scavengerhuntapi.controller
import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid
import net.halfbinary.scavengerhuntapi.model.HuntId
import net.halfbinary.scavengerhuntapi.model.HunterId
import net.halfbinary.scavengerhuntapi.model.ItemId
import net.halfbinary.scavengerhuntapi.model.TeamHuntId
import net.halfbinary.scavengerhuntapi.model.converter.toDomain
import net.halfbinary.scavengerhuntapi.model.converter.toResponse
import net.halfbinary.scavengerhuntapi.model.request.HuntCreateRequest
import net.halfbinary.scavengerhuntapi.model.request.HuntStatus
import net.halfbinary.scavengerhuntapi.model.request.ItemRequest
import net.halfbinary.scavengerhuntapi.model.response.HuntResponse
import net.halfbinary.scavengerhuntapi.model.response.ItemResponse
import net.halfbinary.scavengerhuntapi.service.HuntService
import org.springframework.http.ResponseEntity
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("hunt/{huntId}/item")
@@ -24,18 +21,18 @@ class ItemController(private val huntService: HuntService) {
@GetMapping
fun getItemsForHunt(@PathVariable huntId: HuntId): ResponseEntity<List<ItemResponse>> {
TODO()
TODO("List the Items related to the specified Hunt")
}
@GetMapping("/{itemId}")
fun getItem(@PathVariable huntId: HuntId, @PathVariable itemId: ItemId): ResponseEntity<ItemResponse> {
TODO()
TODO("Get detailed information about the specified Item for the specified Hunt")
}
@PostMapping
@Operation(summary = "Adds new Item to specified Hunt")
fun addItemToHunt(@PathVariable huntId: HuntId, @Valid @RequestBody body: ItemRequest) {
TODO()
TODO("Add a new item to the specified Hunt")
}
}