Skip to content

Commit 0fa1cab

Browse files
committed
feat: add latest songs
1 parent 6b1927b commit 0fa1cab

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/main/kotlin/com/open3r/openmusic/domain/song/controller/SongController.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ class SongController(
3232
fun getRankingSongs(@PageableDefault pageable: Pageable) =
3333
BaseResponse(songService.getRankingSongs(pageable), 200).toEntity()
3434

35+
@Operation(summary = "음악 목록 조회 (최신)")
36+
@GetMapping("/latest")
37+
fun getLatestSongs(@PageableDefault pageable: Pageable) =
38+
BaseResponse(songService.getLatestSongs(pageable), 200).toEntity()
39+
3540
@Operation(summary = "음악 조회")
3641
@GetMapping("/{songId}")
3742
fun getSong(@PathVariable songId: Long) = BaseResponse(songService.getSong(songId), 200).toEntity()

src/main/kotlin/com/open3r/openmusic/domain/song/service/SongService.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface SongService {
1212
fun getSongs(pageable: Pageable): Page<SongResponse>
1313
fun getRankingSongs(pageable: Pageable): Slice<SongResponse>
1414
fun getGenreSongs(genre: SongGenre, pageable: Pageable): Page<SongResponse>
15+
fun getLatestSongs(pageable: Pageable): Slice<SongResponse>
1516
fun getMySongs(): List<SongResponse>
1617
fun getSong(songId: Long): SongResponse
1718
fun playSong(songId: Long): SongResponse

src/main/kotlin/com/open3r/openmusic/domain/song/service/impl/SongServiceImpl.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class SongServiceImpl(
4646
return songQueryRepository.getGenreSongs(genre, pageable).map { it.toResponse() }
4747
}
4848

49+
@Transactional(readOnly = true)
50+
override fun getLatestSongs(pageable: Pageable): Slice<SongResponse> {
51+
return songQueryRepository.getLatestSongs(pageable).map { it.toResponse() }
52+
}
53+
4954
@Transactional(readOnly = true)
5055
override fun getMySongs(): List<SongResponse> {
5156
val user = userSecurity.user

0 commit comments

Comments
 (0)