Adds stubs for item endpoints
This commit is contained in:
@@ -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<List<ItemResponse>> {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{itemId}")
|
||||||
|
fun getItem(@PathVariable huntId: HuntId, @PathVariable itemId: ItemId): ResponseEntity<ItemResponse> {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "Adds new Item to specified Hunt")
|
||||||
|
fun addItemToHunt(@PathVariable huntId: HuntId, @Valid @RequestBody body: ItemRequest) {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package net.halfbinary.scavengerhuntapi.model.request
|
||||||
|
|
||||||
|
data class ItemRequest(
|
||||||
|
val name: String,
|
||||||
|
val points: Int
|
||||||
|
)
|
||||||
@@ -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
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user