/* * Copyright (c) 2023. yo-saito. All Rights Reserved. */ package net.piedpiper.bremer.controller.api import net.piedpiper.bremer.model.api.AudioListResponse import net.piedpiper.bremer.service.app.AudioAppService 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 @RestController @RequestMapping("bremer/api/audio") class AudioApiController( @Qualifier("bremer.service.AudioAppService") private val audioAppService: AudioAppService ) { @GetMapping fun getAudioList( @RequestParam("audio", required = false) audioName: String?, @RequestParam("artist", required = false) artistName: String?, @RequestParam("album", required = false) albumName: String? ): ResponseEntity<AudioListResponse> = ResponseEntity.ok(audioAppService.getByKeywords(audioName, artistName, albumName)) @GetMapping("history") fun getLeastRecentlyPlayedList(): ResponseEntity<AudioListResponse> = ResponseEntity.ok(audioAppService.getLeastRecentlyAccessedAudio()) }