test #247

Merged
klaus merged 9 commits from test into main 2024-12-17 13:43:45 +00:00
1 changed files with 12 additions and 1 deletions
Showing only changes of commit 72cb90357e - Show all commits

View File

@ -28,7 +28,7 @@ class AudioContentPlaylistService(
}
// 콘텐츠 유효성 검사 (소장으로 구매한 콘텐츠 인가?)
checkOrderedContent(
validateContent(
contentIdList = request.contentIdAndOrderList.map { it.contentId },
memberId = member.id!!
)
@ -44,6 +44,17 @@ class AudioContentPlaylistService(
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) {
val orderedContentIdList = orderRepository.findOrderedContent(contentIdList, memberId).toSet()
val orderedContentMap = contentIdList.associateWith { it in orderedContentIdList }