parent
72563e9bfa
commit
72cb90357e
|
@ -28,7 +28,7 @@ class AudioContentPlaylistService(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 콘텐츠 유효성 검사 (소장으로 구매한 콘텐츠 인가?)
|
// 콘텐츠 유효성 검사 (소장으로 구매한 콘텐츠 인가?)
|
||||||
checkOrderedContent(
|
validateContent(
|
||||||
contentIdList = request.contentIdAndOrderList.map { it.contentId },
|
contentIdList = request.contentIdAndOrderList.map { it.contentId },
|
||||||
memberId = member.id!!
|
memberId = member.id!!
|
||||||
)
|
)
|
||||||
|
@ -44,6 +44,17 @@ class AudioContentPlaylistService(
|
||||||
redisRepository.save(playlist)
|
redisRepository.save(playlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun validateContent(contentIdList: List<Long>, memberId: Long) {
|
||||||
|
if (contentIdList.isEmpty()) {
|
||||||
|
throw SodaException("콘텐츠를 1개 이상 추가하세요")
|
||||||
|
}
|
||||||
|
|
||||||
|
checkOrderedContent(
|
||||||
|
contentIdList = contentIdList,
|
||||||
|
memberId = memberId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkOrderedContent(contentIdList: List<Long>, memberId: Long) {
|
private fun checkOrderedContent(contentIdList: List<Long>, memberId: Long) {
|
||||||
val orderedContentIdList = orderRepository.findOrderedContent(contentIdList, memberId).toSet()
|
val orderedContentIdList = orderRepository.findOrderedContent(contentIdList, memberId).toSet()
|
||||||
val orderedContentMap = contentIdList.associateWith { it in orderedContentIdList }
|
val orderedContentMap = contentIdList.associateWith { it in orderedContentIdList }
|
||||||
|
|
Loading…
Reference in New Issue