-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #428 from Team-Ampersand/415-feat/music-rank-query
415 음악 랭킹 조회 api + 최신순 조회 like count 반환값 추가
- Loading branch information
Showing
13 changed files
with
146 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/dotori/v2/domain/music/presentation/data/res/MusicRankListResDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.dotori.v2.domain.music.presentation.data.res | ||
|
||
data class MusicRankListResDto( | ||
val content: List<MusicRankResDto> | ||
) |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/com/dotori/v2/domain/music/presentation/data/res/MusicRankResDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.dotori.v2.domain.music.presentation.data.res | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class MusicRankResDto( | ||
val id: Long, | ||
val rank: Int, | ||
val url: String, | ||
val title: String, | ||
val thumbnail: String, | ||
val username: String, | ||
val email: String, | ||
val createdTime: LocalDateTime, | ||
val stuNum: String, | ||
val likeCount: Int | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/dotori/v2/domain/music/service/FindMusicRankService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.dotori.v2.domain.music.service | ||
|
||
import com.dotori.v2.domain.music.presentation.data.res.MusicRankListResDto | ||
import java.time.LocalDate | ||
|
||
interface FindMusicRankService { | ||
fun execute(date: LocalDate): MusicRankListResDto | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/com/dotori/v2/domain/music/service/impl/FindMusicRankServiceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.dotori.v2.domain.music.service.impl | ||
|
||
import com.dotori.v2.domain.music.domain.repository.MusicRepository | ||
import com.dotori.v2.domain.music.presentation.data.res.MusicRankListResDto | ||
import com.dotori.v2.domain.music.presentation.data.res.MusicRankResDto | ||
import com.dotori.v2.domain.music.service.FindMusicRankService | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
import java.time.LocalDate | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
class FindMusicRankServiceImpl( | ||
private val musicRepository: MusicRepository | ||
) : FindMusicRankService { | ||
|
||
override fun execute(date: LocalDate): MusicRankListResDto { | ||
val responses = musicRepository.findAllByCreatedDateOrderByLikeCount(date) | ||
.mapIndexed { index, music -> | ||
MusicRankResDto( | ||
id = music.id, | ||
rank = index + 1, | ||
url = music.url, | ||
title = music.title, | ||
thumbnail = music.thumbnail, | ||
username = music.member.memberName, | ||
email = music.member.email, | ||
createdTime = music.createdDate, | ||
stuNum = music.member.stuNum, | ||
likeCount = music.likeCount | ||
) | ||
} | ||
|
||
return MusicRankListResDto( | ||
responses | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters