diff --git a/src/main/kotlin/controller/api/AudioApiController.kt b/src/main/kotlin/controller/api/AudioApiController.kt index 53cb909..46b1817 100644 --- a/src/main/kotlin/controller/api/AudioApiController.kt +++ b/src/main/kotlin/controller/api/AudioApiController.kt @@ -4,14 +4,13 @@ package net.piedpiper.bremer.controller.api +import jakarta.validation.Valid import net.piedpiper.bremer.model.api.AudioListResponse +import net.piedpiper.bremer.model.api.AudioRequest import net.piedpiper.bremer.service.AudioService import org.springframework.beans.factory.annotation.Qualifier import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.GetMapping -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.bind.annotation.* @RestController("bremer.controller.AudioApiController") @RequestMapping("bremer/api/audio") @@ -23,6 +22,7 @@ private const val PAGE_LIMIT = 50 } + // TODO 複数キーワード対応 @GetMapping fun getAudioList( @RequestParam("audio", required = false) audioName: String?, @@ -36,4 +36,13 @@ @GetMapping("history") fun getLeastRecentlyPlayedList(): ResponseEntity = ResponseEntity.ok(audioService.getLeastRecentlyAccessedAudio(PAGE_LIMIT)) + + @PutMapping("{slug}") + fun updateAudio( + @PathVariable("slug") slug: String, + @Valid @RequestBody request: AudioRequest + ): ResponseEntity { + audioService.update(slug, request) + return ResponseEntity.ok(null) + } } \ No newline at end of file