test #243
|
@ -15,7 +15,7 @@ data class AudioContentPlaylist(
|
||||||
val memberId: Long,
|
val memberId: Long,
|
||||||
var title: String,
|
var title: String,
|
||||||
var desc: String? = null,
|
var desc: String? = null,
|
||||||
var contentIdAndOrderList: MutableList<PlaylistContentIdAndOrder> = mutableListOf(),
|
var contentIdList: List<Long>,
|
||||||
|
|
||||||
// ISO 8601 형식의 String
|
// ISO 8601 형식의 String
|
||||||
private val _createdAt: String = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
private val _createdAt: String = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AudioContentPlaylistService(
|
||||||
private val redisRepository: AudioContentPlaylistRedisRepository
|
private val redisRepository: AudioContentPlaylistRedisRepository
|
||||||
) {
|
) {
|
||||||
fun createPlaylist(request: CreatePlaylistRequest, member: Member) {
|
fun createPlaylist(request: CreatePlaylistRequest, member: Member) {
|
||||||
if (request.contentIdAndOrderList.size >= 30) {
|
if (request.contentIdList.size >= 30) {
|
||||||
throw SodaException("플레이 리스트에는 최대 30개의 콘텐츠를 저장할 수 있습니다.")
|
throw SodaException("플레이 리스트에는 최대 30개의 콘텐츠를 저장할 수 있습니다.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class AudioContentPlaylistService(
|
||||||
|
|
||||||
// 콘텐츠 유효성 검사 (소장으로 구매한 콘텐츠 인가?)
|
// 콘텐츠 유효성 검사 (소장으로 구매한 콘텐츠 인가?)
|
||||||
checkOrderedContent(
|
checkOrderedContent(
|
||||||
contentIdList = request.contentIdAndOrderList.map { it.contentId },
|
contentIdList = request.contentIdList,
|
||||||
memberId = member.id!!
|
memberId = member.id!!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ class AudioContentPlaylistService(
|
||||||
id = idGenerator.generateId(SEQUENCE_NAME),
|
id = idGenerator.generateId(SEQUENCE_NAME),
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
title = request.title,
|
title = request.title,
|
||||||
desc = request.desc
|
desc = request.desc,
|
||||||
|
contentIdList = request.contentIdList
|
||||||
)
|
)
|
||||||
playlist.contentIdAndOrderList.addAll(request.contentIdAndOrderList)
|
|
||||||
|
|
||||||
redisRepository.save(playlist)
|
redisRepository.save(playlist)
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,9 @@ class AudioContentPlaylistService(
|
||||||
return GetPlaylistsResponse(
|
return GetPlaylistsResponse(
|
||||||
totalCount = playlists.size,
|
totalCount = playlists.size,
|
||||||
items = playlists.map {
|
items = playlists.map {
|
||||||
val contentCount = it.contentIdAndOrderList.size
|
val contentCount = it.contentIdList.size
|
||||||
val coverImageUrl = if (contentCount > 0) {
|
val coverImageUrl = if (contentCount > 0) {
|
||||||
audioContentRepository.getCoverImageById(id = it.contentIdAndOrderList[0].contentId)
|
audioContentRepository.getCoverImageById(id = it.contentIdList[0])
|
||||||
?: ""
|
?: ""
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
|
|
|
@ -3,5 +3,5 @@ package kr.co.vividnext.sodalive.content.playlist
|
||||||
data class CreatePlaylistRequest(
|
data class CreatePlaylistRequest(
|
||||||
val title: String,
|
val title: String,
|
||||||
val desc: String? = null,
|
val desc: String? = null,
|
||||||
val contentIdAndOrderList: List<PlaylistContentIdAndOrder> = emptyList()
|
val contentIdList: List<Long> = emptyList()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.content.playlist
|
|
||||||
|
|
||||||
data class PlaylistContentIdAndOrder(
|
|
||||||
val contentId: Long,
|
|
||||||
val order: Int
|
|
||||||
)
|
|
Loading…
Reference in New Issue