콘텐츠 URL 생성 API
This commit is contained in:
@@ -827,4 +827,25 @@ class AudioContentService(
|
||||
|
||||
pinContent.isActive = false
|
||||
}
|
||||
|
||||
fun generateUrl(contentId: Long, member: Member): GenerateUrlResponse {
|
||||
val audioContent = repository.findByIdOrNull(contentId)
|
||||
?: throw SodaException("잘못된 콘텐츠 입니다.\n다시 시도해 주세요.")
|
||||
|
||||
val isExistsAudioContent = orderRepository.isExistOrdered(
|
||||
memberId = member.id!!,
|
||||
contentId = audioContent.id!!
|
||||
)
|
||||
|
||||
val contentUrl = if (isExistsAudioContent) {
|
||||
audioContentCloudFront.generateSignedURL(
|
||||
resourcePath = audioContent.content!!,
|
||||
expirationTime = 1000 * 60 * 60 * (audioContent.duration!!.split(":")[0].toLong() + 2)
|
||||
)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
return GenerateUrlResponse(contentUrl)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user