parent
36052f034a
commit
0c4dc7e5df
|
@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.live.roulette.RedisIdGenerator
|
||||||
import kr.co.vividnext.sodalive.member.Member
|
import kr.co.vividnext.sodalive.member.Member
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
import java.time.LocalDateTime
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
@ -119,18 +120,22 @@ class AudioContentPlaylistService(
|
||||||
|
|
||||||
return GetPlaylistsResponse(
|
return GetPlaylistsResponse(
|
||||||
totalCount = playlists.size,
|
totalCount = playlists.size,
|
||||||
items = playlists.map {
|
items = playlists.map { playlist ->
|
||||||
val contentCount = it.contentIdAndOrderList.size
|
val contentIdAndOrderList = playlist.contentIdAndOrderList.filter {
|
||||||
|
it.endDate == null || it.endDate!! > LocalDateTime.now()
|
||||||
|
}
|
||||||
|
|
||||||
|
val contentCount = contentIdAndOrderList.size
|
||||||
val coverImageUrl = if (contentCount > 0) {
|
val coverImageUrl = if (contentCount > 0) {
|
||||||
audioContentRepository.getCoverImageById(id = it.contentIdAndOrderList[0].contentId)
|
audioContentRepository.getCoverImageById(id = contentIdAndOrderList[0].contentId)
|
||||||
?: ""
|
?: ""
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
GetPlaylistsItem(
|
GetPlaylistsItem(
|
||||||
id = it.id,
|
id = playlist.id,
|
||||||
title = it.title,
|
title = playlist.title,
|
||||||
desc = it.desc ?: "",
|
desc = playlist.desc ?: "",
|
||||||
contentCount = contentCount,
|
contentCount = contentCount,
|
||||||
coverImageUrl = coverImageUrl
|
coverImageUrl = coverImageUrl
|
||||||
)
|
)
|
||||||
|
@ -163,11 +168,15 @@ class AudioContentPlaylistService(
|
||||||
.withZoneSameInstant(ZoneId.of("Asia/Seoul"))
|
.withZoneSameInstant(ZoneId.of("Asia/Seoul"))
|
||||||
.format(dateTimeFormatter)
|
.format(dateTimeFormatter)
|
||||||
|
|
||||||
|
val contentIdAndOrderList = playlist.contentIdAndOrderList.filter {
|
||||||
|
it.endDate == null || it.endDate!! > LocalDateTime.now()
|
||||||
|
}
|
||||||
|
|
||||||
val contentList = audioContentRepository.fetchContentForPlaylist(
|
val contentList = audioContentRepository.fetchContentForPlaylist(
|
||||||
contentIdList = playlist.contentIdAndOrderList.map { it.contentId }
|
contentIdList = contentIdAndOrderList.map { it.contentId }
|
||||||
)
|
)
|
||||||
|
|
||||||
val orderMap = playlist.contentIdAndOrderList.sortedBy { it.order }
|
val orderMap = contentIdAndOrderList.sortedBy { it.order }
|
||||||
.mapIndexed { index, item -> item.contentId to index }
|
.mapIndexed { index, item -> item.contentId to index }
|
||||||
.toMap()
|
.toMap()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue