플레이 리스트 생성 API 수정
- 기존: 플레이 리스트에 콘텐츠 ID와 정렬순서도 같이 저장됨 - 변경: 콘텐츠 ID만 저장됨 - 이유: List 사용하기에 정렬순서를 별도로 저장할 필요가 없다고 판단
This commit is contained in:
parent
22c5c5be25
commit
10a65294ce
|
@ -15,7 +15,7 @@ data class AudioContentPlaylist(
|
|||
val memberId: Long,
|
||||
var title: String,
|
||||
var desc: String? = null,
|
||||
var contentIdAndOrderList: MutableList<PlaylistContentIdAndOrder> = mutableListOf(),
|
||||
var contentIdList: List<Long>,
|
||||
|
||||
// ISO 8601 형식의 String
|
||||
private val _createdAt: String = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||
|
|
|
@ -16,7 +16,7 @@ class AudioContentPlaylistService(
|
|||
private val redisRepository: AudioContentPlaylistRedisRepository
|
||||
) {
|
||||
fun createPlaylist(request: CreatePlaylistRequest, member: Member) {
|
||||
if (request.contentIdAndOrderList.size >= 30) {
|
||||
if (request.contentIdList.size >= 30) {
|
||||
throw SodaException("플레이 리스트에는 최대 30개의 콘텐츠를 저장할 수 있습니다.")
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class AudioContentPlaylistService(
|
|||
|
||||
// 콘텐츠 유효성 검사 (소장으로 구매한 콘텐츠 인가?)
|
||||
checkOrderedContent(
|
||||
contentIdList = request.contentIdAndOrderList.map { it.contentId },
|
||||
contentIdList = request.contentIdList,
|
||||
memberId = member.id!!
|
||||
)
|
||||
|
||||
|
@ -35,9 +35,9 @@ class AudioContentPlaylistService(
|
|||
id = idGenerator.generateId(SEQUENCE_NAME),
|
||||
memberId = member.id!!,
|
||||
title = request.title,
|
||||
desc = request.desc
|
||||
desc = request.desc,
|
||||
contentIdList = request.contentIdList
|
||||
)
|
||||
playlist.contentIdAndOrderList.addAll(request.contentIdAndOrderList)
|
||||
|
||||
redisRepository.save(playlist)
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ class AudioContentPlaylistService(
|
|||
return GetPlaylistsResponse(
|
||||
totalCount = playlists.size,
|
||||
items = playlists.map {
|
||||
val contentCount = it.contentIdAndOrderList.size
|
||||
val contentCount = it.contentIdList.size
|
||||
val coverImageUrl = if (contentCount > 0) {
|
||||
audioContentRepository.getCoverImageById(id = it.contentIdAndOrderList[0].contentId)
|
||||
audioContentRepository.getCoverImageById(id = it.contentIdList[0])
|
||||
?: ""
|
||||
} else {
|
||||
""
|
||||
|
|
|
@ -3,5 +3,5 @@ package kr.co.vividnext.sodalive.content.playlist
|
|||
data class CreatePlaylistRequest(
|
||||
val title: String,
|
||||
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