콘텐츠 예약 오픈 설정

- 콘텐츠 id뿐 아니라 콘텐츠 전체를 불러와서 중복호출 하지 않도록 수정
This commit is contained in:
Klaus 2024-12-02 08:25:55 +09:00
parent 05592f94b9
commit e0d48712ac
2 changed files with 7 additions and 11 deletions

View File

@ -120,7 +120,7 @@ interface AudioContentQueryRepository {
fun getAudioContentCurationList(isAdult: Boolean, offset: Long, limit: Long): List<AudioContentCuration>
fun getNotReleaseContentId(): List<Long>
fun getNotReleaseContent(): List<AudioContent>
fun isContentCreator(contentId: Long, memberId: Long): Boolean
@ -762,15 +762,14 @@ class AudioContentQueryRepositoryImpl(
.fetch()
}
override fun getNotReleaseContentId(): List<Long> {
override fun getNotReleaseContent(): List<AudioContent> {
val where = audioContent.isActive.isFalse
.and(audioContent.releaseDate.isNotNull)
.and(audioContent.releaseDate.loe(LocalDateTime.now()))
.and(audioContent.duration.isNotNull)
return queryFactory
.select(audioContent.id)
.from(audioContent)
.selectFrom(audioContent)
.where(where)
.fetch()
}

View File

@ -406,12 +406,9 @@ class AudioContentService(
@SchedulerOnly
@Transactional
fun releaseContent() {
val contentIdList = repository.getNotReleaseContentId()
for (contentId in contentIdList) {
val audioContent = repository.findByIdOrNull(contentId)
?: throw SodaException("잘못된 요청입니다.")
val notReleasedAudioContent = repository.getNotReleaseContent()
for (audioContent in notReleasedAudioContent) {
audioContent.isActive = true
applicationEventPublisher.publishEvent(
@ -420,7 +417,7 @@ class AudioContentService(
title = audioContent.member!!.nickname,
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
isAuth = audioContent.isAdult,
contentId = contentId,
contentId = audioContent.id!!,
creatorId = audioContent.member!!.id,
container = "ios"
)
@ -432,7 +429,7 @@ class AudioContentService(
title = audioContent.member!!.nickname,
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
isAuth = audioContent.isAdult,
contentId = contentId,
contentId = audioContent.id!!,
creatorId = audioContent.member!!.id,
container = "aos"
)