Skip to content

Commit

Permalink
feat: add latest songs
Browse files Browse the repository at this point in the history
  • Loading branch information
jbj338033 committed Jul 31, 2024
1 parent 6b1927b commit 0fa1cab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class SongController(
fun getRankingSongs(@PageableDefault pageable: Pageable) =
BaseResponse(songService.getRankingSongs(pageable), 200).toEntity()

@Operation(summary = "음악 목록 조회 (최신)")
@GetMapping("/latest")
fun getLatestSongs(@PageableDefault pageable: Pageable) =
BaseResponse(songService.getLatestSongs(pageable), 200).toEntity()

@Operation(summary = "음악 조회")
@GetMapping("/{songId}")
fun getSong(@PathVariable songId: Long) = BaseResponse(songService.getSong(songId), 200).toEntity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface SongService {
fun getSongs(pageable: Pageable): Page<SongResponse>
fun getRankingSongs(pageable: Pageable): Slice<SongResponse>
fun getGenreSongs(genre: SongGenre, pageable: Pageable): Page<SongResponse>
fun getLatestSongs(pageable: Pageable): Slice<SongResponse>
fun getMySongs(): List<SongResponse>
fun getSong(songId: Long): SongResponse
fun playSong(songId: Long): SongResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class SongServiceImpl(
return songQueryRepository.getGenreSongs(genre, pageable).map { it.toResponse() }
}

@Transactional(readOnly = true)
override fun getLatestSongs(pageable: Pageable): Slice<SongResponse> {
return songQueryRepository.getLatestSongs(pageable).map { it.toResponse() }
}

@Transactional(readOnly = true)
override fun getMySongs(): List<SongResponse> {
val user = userSecurity.user
Expand Down

0 comments on commit 0fa1cab

Please sign in to comment.