라이브 취소 푸시 발송 로직 추가

This commit is contained in:
2023-09-01 16:46:43 +09:00
parent 8f50d05906
commit d6dfa63bea
3 changed files with 76 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ interface MemberQueryRepository {
fun getMemberByEmail(email: String): Member?
fun getChangeNoticeRecipientPushTokens(creatorId: Long): Map<String, List<List<String>>>
fun getPushTokenFromReservationList(roomId: Long): Map<String, List<List<String>>>
}
@Repository
@@ -255,9 +256,11 @@ class MemberQueryRepositoryImpl(
)
.from(message)
.innerJoin(message.recipient, member)
.innerJoin(member.notification, memberNotification)
.where(
message.id.eq(messageId)
.and(member.pushToken.isNotNull)
.and(memberNotification.message.isTrue)
)
.fetchFirst()
}
@@ -356,4 +359,35 @@ class MemberQueryRepositoryImpl(
return mapOf("aos" to aosPushTokens, "ios" to iosPushTokens)
}
override fun getPushTokenFromReservationList(roomId: Long): Map<String, List<List<String>>> {
val query = queryFactory
.select(liveReservation.member.pushToken)
.from(liveReservation)
.innerJoin(liveReservation.room, liveRoom)
.innerJoin(liveReservation.member, member)
val where = liveRoom.id.eq(roomId)
.and(liveReservation.isActive.isTrue)
val aosPushTokens = query
.where(
where
.and(member.container.eq("aos"))
)
.fetch()
.toSet()
.chunked(500)
val iosPushTokens = query
.where(
where
.and(member.container.eq("ios"))
)
.fetch()
.toSet()
.chunked(500)
return mapOf("aos" to aosPushTokens, "ios" to iosPushTokens)
}
}