Removes redundant DB data fields and adds photo submission endpoint along with MinIO support for image storage
This commit is contained in:
@@ -11,6 +11,7 @@ import net.halfbinary.scavengerhuntapi.model.request.TeamRequest
|
||||
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.PhotoService
|
||||
import net.halfbinary.scavengerhuntapi.service.TeamService
|
||||
import org.springframework.core.io.InputStreamSource
|
||||
import org.springframework.http.ResponseEntity
|
||||
@@ -26,7 +27,7 @@ import org.springframework.web.multipart.MultipartFile
|
||||
|
||||
@RestController
|
||||
@RequestMapping("hunt/{huntId}/team")
|
||||
class TeamController(private val teamService: TeamService) {
|
||||
class TeamController(private val teamService: TeamService, private val photoService: PhotoService) {
|
||||
@GetMapping
|
||||
@Operation(summary = "List all teams for the specified hunt")
|
||||
fun listHuntTeams(@PathVariable huntId: HuntId): ResponseEntity<List<TeamResponse>> {
|
||||
@@ -51,7 +52,8 @@ class TeamController(private val teamService: TeamService) {
|
||||
fun getItemForTeam(@PathVariable huntId: HuntId,
|
||||
@PathVariable teamId: TeamId,
|
||||
@PathVariable itemId: ItemId): ResponseEntity<TeamItemResponse> {
|
||||
TODO("Get found/not found status and photo information about the Item for the specified Team, Hunt, and Item")
|
||||
TODO("Get found/not found status about the Item for the specified Team, Hunt, and Item")
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/{teamId}/item/{itemId}/photo")
|
||||
@@ -87,7 +89,7 @@ class TeamController(private val teamService: TeamService) {
|
||||
@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")
|
||||
return ResponseEntity.ok(photoService.submitPhoto(huntId, itemId, authentication.name, file).toResponse())
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user