Merge pull request 'test' (#114) from test into main

Reviewed-on: #114
This commit is contained in:
klaus 2024-01-11 03:49:53 +00:00
commit 2282a49563
5 changed files with 42 additions and 45 deletions

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 {
// 묶음 콘텐츠 조회 // 묶음 콘텐츠 조회

View File

@ -5,7 +5,7 @@ data class CreateAudioContentRequest(
val detail: String, val detail: String,
val tags: String, val tags: String,
val price: Int, val price: Int,
val timezone: String, val timezone: String = "Asia/Seoul",
val releaseDate: String? = null, val releaseDate: String? = null,
val themeId: Long = 0, val themeId: Long = 0,
val isAdult: Boolean = false, val isAdult: Boolean = false,

View File

@ -186,6 +186,7 @@ class FcmSendListener(
FcmEventType.SEND_MESSAGE -> { FcmEventType.SEND_MESSAGE -> {
val response = memberRepository.getMessageRecipientPushToken(messageId = fcmEvent.messageId!!) val response = memberRepository.getMessageRecipientPushToken(messageId = fcmEvent.messageId!!)
if (response != null) {
pushService.send( pushService.send(
tokens = listOf(response.pushToken), tokens = listOf(response.pushToken),
title = fcmEvent.title, title = fcmEvent.title,
@ -194,6 +195,7 @@ class FcmSendListener(
messageId = fcmEvent.messageId messageId = fcmEvent.messageId
) )
} }
}
FcmEventType.CHANGE_NOTICE -> { FcmEventType.CHANGE_NOTICE -> {
if (fcmEvent.creatorId != null) { if (fcmEvent.creatorId != null) {

View File

@ -45,7 +45,7 @@ interface MemberQueryRepository {
container: String container: String
): List<List<String>> ): List<List<String>>
fun getMessageRecipientPushToken(messageId: Long): GetMessageRecipientPushTokenResponse fun getMessageRecipientPushToken(messageId: Long): GetMessageRecipientPushTokenResponse?
fun getIndividualRecipientPushTokens(recipients: List<Long>, isAuth: Boolean?): Map<String, List<List<String>>> fun getIndividualRecipientPushTokens(recipients: List<Long>, isAuth: Boolean?): Map<String, List<List<String>>>
fun getChangeNicknamePrice(memberId: Long): GetChangeNicknamePriceResponse fun getChangeNicknamePrice(memberId: Long): GetChangeNicknamePriceResponse
fun getMemberByEmail(email: String): Member? fun getMemberByEmail(email: String): Member?
@ -259,7 +259,7 @@ class MemberQueryRepositoryImpl(
.chunked(500) .chunked(500)
} }
override fun getMessageRecipientPushToken(messageId: Long): GetMessageRecipientPushTokenResponse { override fun getMessageRecipientPushToken(messageId: Long): GetMessageRecipientPushTokenResponse? {
return queryFactory return queryFactory
.select( .select(
QGetMessageRecipientPushTokenResponse( QGetMessageRecipientPushTokenResponse(