예약 업로드 배포 로직 위치 이동
This commit is contained in:
parent
3e8476431d
commit
afe529a116
|
@ -25,10 +25,7 @@ import java.time.temporal.TemporalAdjusters
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/audio-content")
|
||||
class AudioContentController(
|
||||
private val service: AudioContentService,
|
||||
private val repository: AudioContentRepository
|
||||
) {
|
||||
class AudioContentController(private val service: AudioContentService) {
|
||||
@PostMapping
|
||||
@PreAuthorize("hasRole('CREATOR')")
|
||||
fun createAudioContent(
|
||||
|
@ -197,12 +194,6 @@ class AudioContentController(
|
|||
@PostMapping("/release")
|
||||
@PreAuthorize("hasRole('BOT')")
|
||||
fun releaseContent() = run {
|
||||
val contentIdList = repository.getNotReleaseContentId()
|
||||
|
||||
for (contentId in contentIdList) {
|
||||
service.releaseContent(contentId)
|
||||
}
|
||||
|
||||
ApiResponse.ok(null)
|
||||
ApiResponse.ok(service.releaseContent())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,35 +387,39 @@ class AudioContentService(
|
|||
}
|
||||
|
||||
@Transactional
|
||||
fun releaseContent(contentId: Long) {
|
||||
val audioContent = repository.findByIdOrNull(contentId)
|
||||
?: throw SodaException("잘못된 요청입니다.")
|
||||
fun releaseContent() {
|
||||
val contentIdList = repository.getNotReleaseContentId()
|
||||
|
||||
audioContent.isActive = true
|
||||
for (contentId in contentIdList) {
|
||||
val audioContent = repository.findByIdOrNull(contentId)
|
||||
?: throw SodaException("잘못된 요청입니다.")
|
||||
|
||||
applicationEventPublisher.publishEvent(
|
||||
FcmEvent(
|
||||
type = FcmEventType.UPLOAD_CONTENT,
|
||||
title = audioContent.member!!.nickname,
|
||||
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
|
||||
isAuth = audioContent.isAdult,
|
||||
contentId = contentId,
|
||||
creatorId = audioContent.member!!.id,
|
||||
container = "ios"
|
||||
audioContent.isActive = true
|
||||
|
||||
applicationEventPublisher.publishEvent(
|
||||
FcmEvent(
|
||||
type = FcmEventType.UPLOAD_CONTENT,
|
||||
title = audioContent.member!!.nickname,
|
||||
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
|
||||
isAuth = audioContent.isAdult,
|
||||
contentId = contentId,
|
||||
creatorId = audioContent.member!!.id,
|
||||
container = "ios"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
applicationEventPublisher.publishEvent(
|
||||
FcmEvent(
|
||||
type = FcmEventType.UPLOAD_CONTENT,
|
||||
title = audioContent.member!!.nickname,
|
||||
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
|
||||
isAuth = audioContent.isAdult,
|
||||
contentId = contentId,
|
||||
creatorId = audioContent.member!!.id,
|
||||
container = "aos"
|
||||
applicationEventPublisher.publishEvent(
|
||||
FcmEvent(
|
||||
type = FcmEventType.UPLOAD_CONTENT,
|
||||
title = audioContent.member!!.nickname,
|
||||
message = "콘텐츠를 업로드 하였습니다. - ${audioContent.title}",
|
||||
isAuth = audioContent.isAdult,
|
||||
contentId = contentId,
|
||||
creatorId = audioContent.member!!.id,
|
||||
container = "aos"
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun getDetail(id: Long, member: Member, timezone: String): GetAudioContentDetailResponse {
|
||||
|
|
Loading…
Reference in New Issue