From aff7cd1e28204d86617667cdab95c2ec464238ff Mon Sep 17 00:00:00 2001 From: aarbit Date: Tue, 12 May 2026 10:11:20 -0500 Subject: [PATCH] Adds stubs for item endpoints --- .../controller/ItemController.kt | 41 +++++++++++++++++++ .../model/request/ItemRequest.kt | 6 +++ .../model/response/ItemResponse.kt | 9 ++++ 3 files changed, 56 insertions(+) create mode 100644 src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/ItemController.kt create mode 100644 src/main/kotlin/net/halfbinary/scavengerhuntapi/model/request/ItemRequest.kt create mode 100644 src/main/kotlin/net/halfbinary/scavengerhuntapi/model/response/ItemResponse.kt diff --git a/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/ItemController.kt b/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/ItemController.kt new file mode 100644 index 0000000..1549ffd --- /dev/null +++ b/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/ItemController.kt @@ -0,0 +1,41 @@ +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.* + +@RestController +@RequestMapping("hunt/{huntId}/item") +class ItemController(private val huntService: HuntService) { + + @GetMapping + fun getItemsForHunt(@PathVariable huntId: HuntId): ResponseEntity> { + TODO() + } + + @GetMapping("/{itemId}") + fun getItem(@PathVariable huntId: HuntId, @PathVariable itemId: ItemId): ResponseEntity { + TODO() + } + + @PostMapping + @Operation(summary = "Adds new Item to specified Hunt") + fun addItemToHunt(@PathVariable huntId: HuntId, @Valid @RequestBody body: ItemRequest) { + TODO() + } + +} \ No newline at end of file diff --git a/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/request/ItemRequest.kt b/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/request/ItemRequest.kt new file mode 100644 index 0000000..824aec0 --- /dev/null +++ b/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/request/ItemRequest.kt @@ -0,0 +1,6 @@ +package net.halfbinary.scavengerhuntapi.model.request + +data class ItemRequest( + val name: String, + val points: Int +) diff --git a/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/response/ItemResponse.kt b/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/response/ItemResponse.kt new file mode 100644 index 0000000..b684540 --- /dev/null +++ b/src/main/kotlin/net/halfbinary/scavengerhuntapi/model/response/ItemResponse.kt @@ -0,0 +1,9 @@ +package net.halfbinary.scavengerhuntapi.model.response + +import net.halfbinary.scavengerhuntapi.model.ItemId + +data class ItemResponse( + val id: ItemId, + val name: String, + val points: Int +)