diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/fcm/FcmEvent.kt b/src/main/kotlin/kr/co/vividnext/sodalive/fcm/FcmEvent.kt index 37b4820..8b0c4d9 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/fcm/FcmEvent.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/fcm/FcmEvent.kt @@ -20,7 +20,7 @@ class FcmEvent( val container: String = "", val recipients: List = listOf(), val recipientsMap: Map>>? = null, - val isAuth: Boolean = false, + val isAuth: Boolean? = null, val roomId: Long? = null, val contentId: Long? = null, val messageId: Long? = null, @@ -97,7 +97,7 @@ class FcmSendListener( if (fcmEvent.container.isNotBlank()) { val pushTokens = memberRepository.getCreateLiveRoomNotificationRecipientPushTokens( creatorId = fcmEvent.creatorId!!, - isAuth = fcmEvent.isAuth, + isAuth = fcmEvent.isAuth ?: false, container = fcmEvent.container ) @@ -118,7 +118,7 @@ class FcmSendListener( val pushTokens = memberRepository.getStartLiveRoomNotificationRecipientPushTokens( creatorId = fcmEvent.creatorId!!, roomId = fcmEvent.roomId!!, - isAuth = fcmEvent.isAuth, + isAuth = fcmEvent.isAuth ?: false, container = fcmEvent.container ) @@ -166,7 +166,7 @@ class FcmSendListener( if (fcmEvent.container.isNotBlank()) { val pushTokens = memberRepository.getUploadContentNotificationRecipientPushTokens( creatorId = fcmEvent.creatorId!!, - isAuth = fcmEvent.isAuth, + isAuth = fcmEvent.isAuth ?: false, container = fcmEvent.container ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/fcm/PushRequest.kt b/src/main/kotlin/kr/co/vividnext/sodalive/fcm/PushRequest.kt index c0966b4..c73a26c 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/fcm/PushRequest.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/fcm/PushRequest.kt @@ -3,5 +3,6 @@ package kr.co.vividnext.sodalive.fcm data class PushRequest( val memberIds: List, val title: String, - val message: String + val message: String, + val isAuth: Boolean? ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberRepository.kt index c85cefa..db9eacf 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberRepository.kt @@ -25,7 +25,7 @@ interface MemberQueryRepository { fun findByPushToken(pushToken: String): List fun findByNicknameAndOtherCondition(nickname: String, member: Member): List fun findCreatorByIdOrNull(memberId: Long): Member? - fun getAllRecipientPushTokens(isAuth: Boolean, container: String): List> + fun getAllRecipientPushTokens(isAuth: Boolean?, container: String): List> fun getCreateLiveRoomNotificationRecipientPushTokens( creatorId: Long, isAuth: Boolean, @@ -46,7 +46,7 @@ interface MemberQueryRepository { ): List> fun getMessageRecipientPushToken(messageId: Long): GetMessageRecipientPushTokenResponse - fun getIndividualRecipientPushTokens(recipients: List, isAuth: Boolean): Map>> + fun getIndividualRecipientPushTokens(recipients: List, isAuth: Boolean?): Map>> fun getChangeNicknamePrice(memberId: Long): GetChangeNicknamePriceResponse fun getMemberByEmail(email: String): Member? @@ -93,14 +93,18 @@ class MemberQueryRepositoryImpl( .fetchFirst() } - override fun getAllRecipientPushTokens(isAuth: Boolean, container: String): List> { + override fun getAllRecipientPushTokens(isAuth: Boolean?, container: String): List> { var where = member.isActive.isTrue .and(member.email.notIn("admin@sodalive.net")) .and(member.container.eq(container)) .and(member.pushToken.isNotNull) - if (isAuth) { - where = where.and(member.auth.isNotNull) + if (isAuth != null) { + where = if (isAuth) { + where.and(member.auth.isNotNull) + } else { + where.and(member.auth.isNull) + } } return queryFactory @@ -276,15 +280,19 @@ class MemberQueryRepositoryImpl( override fun getIndividualRecipientPushTokens( recipients: List, - isAuth: Boolean + isAuth: Boolean? ): Map>> { var where = member.isActive.isTrue .and(member.email.notIn("admin@sodalive.net")) .and(member.id.`in`(*recipients.toTypedArray())) .and(member.pushToken.isNotNull) - if (isAuth) { - where = where.and(member.auth.isNotNull) + if (isAuth != null) { + where = if (isAuth) { + where.and(member.auth.isNotNull) + } else { + where.and(member.auth.isNull) + } } val aosPushTokens = queryFactory