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 +)