test #114

Merged
klaus merged 3 commits from test into main 2024-01-11 03:49:54 +00:00
2 changed files with 30 additions and 35 deletions
Showing only changes of commit afe529a116 - Show all commits

View File

@ -25,10 +25,7 @@ import java.time.temporal.TemporalAdjusters
@RestController @RestController
@RequestMapping("/audio-content") @RequestMapping("/audio-content")
class AudioContentController( class AudioContentController(private val service: AudioContentService) {
private val service: AudioContentService,
private val repository: AudioContentRepository
) {
@PostMapping @PostMapping
@PreAuthorize("hasRole('CREATOR')") @PreAuthorize("hasRole('CREATOR')")
fun createAudioContent( fun createAudioContent(
@ -197,12 +194,6 @@ class AudioContentController(
@PostMapping("/release") @PostMapping("/release")
@PreAuthorize("hasRole('BOT')") @PreAuthorize("hasRole('BOT')")
fun releaseContent() = run { fun releaseContent() = run {
val contentIdList = repository.getNotReleaseContentId() ApiResponse.ok(service.releaseContent())
for (contentId in contentIdList) {
service.releaseContent(contentId)
}
ApiResponse.ok(null)
} }
} }

View File

@ -387,7 +387,10 @@ class AudioContentService(
} }
@Transactional @Transactional
fun releaseContent(contentId: Long) { fun releaseContent() {
val contentIdList = repository.getNotReleaseContentId()
for (contentId in contentIdList) {
val audioContent = repository.findByIdOrNull(contentId) val audioContent = repository.findByIdOrNull(contentId)
?: throw SodaException("잘못된 요청입니다.") ?: throw SodaException("잘못된 요청입니다.")
@ -417,6 +420,7 @@ class AudioContentService(
) )
) )
} }
}
fun getDetail(id: Long, member: Member, timezone: String): GetAudioContentDetailResponse { fun getDetail(id: Long, member: Member, timezone: String): GetAudioContentDetailResponse {
// 묶음 콘텐츠 조회 // 묶음 콘텐츠 조회