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

Reviewed-on: #94
This commit is contained in:
klaus 2023-11-24 07:03:10 +00:00
commit 3795fb4a40
7 changed files with 31 additions and 19 deletions

View File

@ -81,7 +81,7 @@ class ChargeEventService(
title = chargeEvent.title, title = chargeEvent.title,
message = "$additionalCan 캔이 추가 지급되었습니다.", message = "$additionalCan 캔이 추가 지급되었습니다.",
recipients = listOf(member.id!!), recipients = listOf(member.id!!),
isAuth = false isAuth = null
) )
) )
} }
@ -103,7 +103,7 @@ class ChargeEventService(
title = "첫 충전 이벤트", title = "첫 충전 이벤트",
message = "$additionalCan 캔이 추가 지급되었습니다.", message = "$additionalCan 캔이 추가 지급되었습니다.",
recipients = listOf(member.id!!), recipients = listOf(member.id!!),
isAuth = false isAuth = null
) )
) )
} }

View File

@ -78,7 +78,7 @@ class AdsChargeService(
title = "제휴보상", title = "제휴보상",
message = "${adsCharge.point.toInt()} 캔이 지급되었습니다.", message = "${adsCharge.point.toInt()} 캔이 지급되었습니다.",
recipients = listOf(member.id!!), recipients = listOf(member.id!!),
isAuth = false isAuth = null
) )
) )
} }

View File

@ -341,7 +341,7 @@ class AudioContentService(
title = "콘텐츠 등록완료", title = "콘텐츠 등록완료",
message = audioContent.title, message = audioContent.title,
recipients = listOf(audioContent.member!!.id!!), recipients = listOf(audioContent.member!!.id!!),
isAuth = audioContent.isAdult, isAuth = null,
contentId = contentId contentId = contentId
) )
) )

View File

@ -22,6 +22,7 @@ class FcmController(private val applicationEventPublisher: ApplicationEventPubli
FcmEvent( FcmEvent(
type = FcmEventType.INDIVIDUAL, type = FcmEventType.INDIVIDUAL,
title = request.title, title = request.title,
isAuth = request.isAuth,
message = request.message, message = request.message,
recipients = request.memberIds recipients = request.memberIds
) )
@ -32,7 +33,8 @@ class FcmController(private val applicationEventPublisher: ApplicationEventPubli
type = FcmEventType.ALL, type = FcmEventType.ALL,
title = request.title, title = request.title,
message = request.message, message = request.message,
container = "ios" container = "ios",
isAuth = request.isAuth
) )
) )
@ -41,7 +43,8 @@ class FcmController(private val applicationEventPublisher: ApplicationEventPubli
type = FcmEventType.ALL, type = FcmEventType.ALL,
title = request.title, title = request.title,
message = request.message, message = request.message,
container = "aos" container = "aos",
isAuth = request.isAuth
) )
) )
} }

View File

@ -20,7 +20,7 @@ class FcmEvent(
val container: String = "", val container: String = "",
val recipients: List<Long> = listOf(), val recipients: List<Long> = listOf(),
val recipientsMap: Map<String, List<List<String>>>? = null, val recipientsMap: Map<String, List<List<String>>>? = null,
val isAuth: Boolean = false, val isAuth: Boolean? = null,
val roomId: Long? = null, val roomId: Long? = null,
val contentId: Long? = null, val contentId: Long? = null,
val messageId: Long? = null, val messageId: Long? = null,
@ -97,7 +97,7 @@ class FcmSendListener(
if (fcmEvent.container.isNotBlank()) { if (fcmEvent.container.isNotBlank()) {
val pushTokens = memberRepository.getCreateLiveRoomNotificationRecipientPushTokens( val pushTokens = memberRepository.getCreateLiveRoomNotificationRecipientPushTokens(
creatorId = fcmEvent.creatorId!!, creatorId = fcmEvent.creatorId!!,
isAuth = fcmEvent.isAuth, isAuth = fcmEvent.isAuth ?: false,
container = fcmEvent.container container = fcmEvent.container
) )
@ -118,7 +118,7 @@ class FcmSendListener(
val pushTokens = memberRepository.getStartLiveRoomNotificationRecipientPushTokens( val pushTokens = memberRepository.getStartLiveRoomNotificationRecipientPushTokens(
creatorId = fcmEvent.creatorId!!, creatorId = fcmEvent.creatorId!!,
roomId = fcmEvent.roomId!!, roomId = fcmEvent.roomId!!,
isAuth = fcmEvent.isAuth, isAuth = fcmEvent.isAuth ?: false,
container = fcmEvent.container container = fcmEvent.container
) )
@ -166,7 +166,7 @@ class FcmSendListener(
if (fcmEvent.container.isNotBlank()) { if (fcmEvent.container.isNotBlank()) {
val pushTokens = memberRepository.getUploadContentNotificationRecipientPushTokens( val pushTokens = memberRepository.getUploadContentNotificationRecipientPushTokens(
creatorId = fcmEvent.creatorId!!, creatorId = fcmEvent.creatorId!!,
isAuth = fcmEvent.isAuth, isAuth = fcmEvent.isAuth ?: false,
container = fcmEvent.container container = fcmEvent.container
) )

View File

@ -3,5 +3,6 @@ package kr.co.vividnext.sodalive.fcm
data class PushRequest( data class PushRequest(
val memberIds: List<Long>, val memberIds: List<Long>,
val title: String, val title: String,
val message: String val message: String,
val isAuth: Boolean?
) )

View File

@ -25,7 +25,7 @@ interface MemberQueryRepository {
fun findByPushToken(pushToken: String): List<Member> fun findByPushToken(pushToken: String): List<Member>
fun findByNicknameAndOtherCondition(nickname: String, member: Member): List<Member> fun findByNicknameAndOtherCondition(nickname: String, member: Member): List<Member>
fun findCreatorByIdOrNull(memberId: Long): Member? fun findCreatorByIdOrNull(memberId: Long): Member?
fun getAllRecipientPushTokens(isAuth: Boolean, container: String): List<List<String>> fun getAllRecipientPushTokens(isAuth: Boolean?, container: String): List<List<String>>
fun getCreateLiveRoomNotificationRecipientPushTokens( fun getCreateLiveRoomNotificationRecipientPushTokens(
creatorId: Long, creatorId: Long,
isAuth: Boolean, isAuth: Boolean,
@ -46,7 +46,7 @@ interface MemberQueryRepository {
): 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?
@ -93,14 +93,18 @@ class MemberQueryRepositoryImpl(
.fetchFirst() .fetchFirst()
} }
override fun getAllRecipientPushTokens(isAuth: Boolean, container: String): List<List<String>> { override fun getAllRecipientPushTokens(isAuth: Boolean?, container: String): List<List<String>> {
var where = member.isActive.isTrue var where = member.isActive.isTrue
.and(member.email.notIn("admin@sodalive.net")) .and(member.email.notIn("admin@sodalive.net"))
.and(member.container.eq(container)) .and(member.container.eq(container))
.and(member.pushToken.isNotNull) .and(member.pushToken.isNotNull)
if (isAuth) { if (isAuth != null) {
where = where.and(member.auth.isNotNull) where = if (isAuth) {
where.and(auth.isNotNull)
} else {
where.and(auth.isNull)
}
} }
return queryFactory return queryFactory
@ -276,15 +280,19 @@ class MemberQueryRepositoryImpl(
override fun getIndividualRecipientPushTokens( override fun getIndividualRecipientPushTokens(
recipients: List<Long>, recipients: List<Long>,
isAuth: Boolean isAuth: Boolean?
): Map<String, List<List<String>>> { ): Map<String, List<List<String>>> {
var where = member.isActive.isTrue var where = member.isActive.isTrue
.and(member.email.notIn("admin@sodalive.net")) .and(member.email.notIn("admin@sodalive.net"))
.and(member.id.`in`(*recipients.toTypedArray())) .and(member.id.`in`(*recipients.toTypedArray()))
.and(member.pushToken.isNotNull) .and(member.pushToken.isNotNull)
if (isAuth) { if (isAuth != null) {
where = where.and(member.auth.isNotNull) where = if (isAuth) {
where.and(auth.isNotNull)
} else {
where.and(auth.isNull)
}
} }
val aosPushTokens = queryFactory val aosPushTokens = queryFactory