diff --git a/src/main/kotlin/controller/api/PlaylistApiController.kt b/src/main/kotlin/controller/api/PlaylistApiController.kt index 55598f2..4c5dc9f 100644 --- a/src/main/kotlin/controller/api/PlaylistApiController.kt +++ b/src/main/kotlin/controller/api/PlaylistApiController.kt @@ -5,21 +5,15 @@ package net.piedpiper.bremer.controller.api import jakarta.validation.Valid -import net.piedpiper.bremer.model.api.PlaylistAudioResponse import net.piedpiper.bremer.model.api.AllPlaylistResponse -import net.piedpiper.bremer.model.api.PlaylistRequest import net.piedpiper.bremer.model.api.PlaylistAudioRequest +import net.piedpiper.bremer.model.api.PlaylistAudioResponse +import net.piedpiper.bremer.model.api.PlaylistRequest import net.piedpiper.bremer.service.PlaylistService +import org.apache.logging.log4j.LogManager import org.springframework.beans.factory.annotation.Qualifier import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.DeleteMapping -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* @RestController("bremer.controller.PlaylistApiController") @RequestMapping("bremer/api/playlist") @@ -27,6 +21,9 @@ @Qualifier("bremer.service.PlaylistService") private val playlistService: PlaylistService, ) { + companion object{ + private val log = LogManager.getLogger(PlaylistApiController::class.java) + } @GetMapping fun getAllPlaylists(): ResponseEntity = ResponseEntity.ok(playlistService.getAllPlaylists()) @@ -65,6 +62,7 @@ @PathVariable("slug") slug: String, @Valid @RequestBody request: PlaylistAudioRequest ): ResponseEntity { + log.info("recieve: {}", request) playlistService.updatePlaylistAudioList(slug, request) return ResponseEntity.ok(null) } diff --git a/src/main/kotlin/service/PlaylistService.kt b/src/main/kotlin/service/PlaylistService.kt index bf26999..951945e 100644 --- a/src/main/kotlin/service/PlaylistService.kt +++ b/src/main/kotlin/service/PlaylistService.kt @@ -137,15 +137,4 @@ } } ?: throw NotFoundException() } - - private fun convertToPlaylistAudioResponse(entity: PlaylistEntity): PlaylistAudioResponse { - val audioList = entity?.playlistAudio?.mapNotNull { it.audioId } - ?.let { - findAllByOrderedIds(it) - } ?: emptyList() - return PlaylistAudioResponse( - playlistEntity = entity, - audioEntityList = audioList - ) - } } \ No newline at end of file