Adds/collects Hunter endpoints and cleans up the code a bit
This commit is contained in:
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation
|
||||
import jakarta.validation.Valid
|
||||
import net.halfbinary.scavengerhuntapi.model.HuntId
|
||||
import net.halfbinary.scavengerhuntapi.model.ItemId
|
||||
import net.halfbinary.scavengerhuntapi.model.PhotoId
|
||||
import net.halfbinary.scavengerhuntapi.model.TeamId
|
||||
import net.halfbinary.scavengerhuntapi.model.converter.toResponse
|
||||
import net.halfbinary.scavengerhuntapi.model.request.TeamRequest
|
||||
@@ -11,6 +12,7 @@ import net.halfbinary.scavengerhuntapi.model.response.PhotoResponse
|
||||
import net.halfbinary.scavengerhuntapi.model.response.TeamItemResponse
|
||||
import net.halfbinary.scavengerhuntapi.model.response.TeamResponse
|
||||
import net.halfbinary.scavengerhuntapi.service.TeamService
|
||||
import org.springframework.core.io.InputStreamSource
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.security.core.Authentication
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
@@ -18,7 +20,9 @@ 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.RequestParam
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.web.multipart.MultipartFile
|
||||
|
||||
@RestController
|
||||
@RequestMapping("hunt/{huntId}/team")
|
||||
@@ -41,24 +45,43 @@ class TeamController(private val teamService: TeamService) {
|
||||
return ResponseEntity.ok(teamService.getTeamFromHunt(huntId, teamId).toResponse())
|
||||
}
|
||||
|
||||
@PostMapping("/{teamId}")
|
||||
fun joinTeamForHunt(@PathVariable huntId: HuntId, @PathVariable teamId: TeamId, authentication: Authentication) {
|
||||
teamService.joinTeam(teamId, authentication.name)
|
||||
}
|
||||
|
||||
@GetMapping("/{teamId}/item/{itemId}")
|
||||
fun getItemsForTeam(@PathVariable huntId: HuntId,
|
||||
fun getItemForTeam(@PathVariable huntId: HuntId,
|
||||
@PathVariable teamId: TeamId,
|
||||
@PathVariable itemId: ItemId): ResponseEntity<TeamItemResponse> {
|
||||
TODO()
|
||||
TODO("Get found/not found status and photo information about the Item for the specified Team, Hunt, and Item")
|
||||
}
|
||||
|
||||
@GetMapping("/{teamId}/item/{itemId}/photo")
|
||||
fun getPhotosForTeam(@PathVariable huntId: HuntId,
|
||||
fun getItemPhotos(@PathVariable huntId: HuntId,
|
||||
@PathVariable teamId: TeamId,
|
||||
@PathVariable itemId: ItemId): ResponseEntity<PhotoResponse> {
|
||||
TODO()
|
||||
@PathVariable itemId: ItemId): ResponseEntity<List<PhotoResponse>> {
|
||||
TODO("Get list of photo information for the specified Team, Hunt, and Item")
|
||||
}
|
||||
|
||||
@GetMapping("/{teamId}/item/{itemId}/photo/{photoId}")
|
||||
fun getPhotoInfo(@PathVariable huntId: HuntId,
|
||||
@PathVariable teamId: TeamId,
|
||||
@PathVariable itemId: ItemId,
|
||||
@PathVariable photoId: PhotoId): ResponseEntity<PhotoResponse> {
|
||||
TODO("Get photo information for the specified Team, Hunt, Item, and Photo")
|
||||
}
|
||||
|
||||
@GetMapping("/{teamId}/item/{itemId}/photo/{photoId}/file")
|
||||
fun getPhoto(@PathVariable huntId: HuntId,
|
||||
@PathVariable teamId: TeamId,
|
||||
@PathVariable itemId: ItemId,
|
||||
@PathVariable photoId: PhotoId): ResponseEntity<InputStreamSource> {
|
||||
TODO("Get the binary image information for the specified Team, Hunt, Item, and Photo")
|
||||
}
|
||||
|
||||
@PostMapping("/{teamId}/item/{itemId}/photo")
|
||||
fun submitPhoto(@PathVariable huntId: HuntId,
|
||||
@PathVariable teamId: TeamId,
|
||||
@PathVariable itemId: ItemId,
|
||||
authentication: Authentication,
|
||||
@RequestParam file: MultipartFile): ResponseEntity<PhotoResponse> {
|
||||
TODO("Save photo information in the Photo table so that it relates to the specified Team, Hunt, Hunter, and Item, and store the binary file")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user