modified send push method

This commit is contained in:
abutalib-kiwi
2023-09-27 19:31:09 +05:30
parent 251a912948
commit 18143e0219

View File

@ -112,6 +112,7 @@ def send_notification(notification_type, from_user_id, from_user_type, to_user_i
def send_push(user, data):
""" used to send push notification to specific user """
data['notification_type'] = str(data['notification_type'])
user.fcmdevice_set.filter(active=True).send_message(
Message(notification=FirebaseNotification(data['title'], data['body']), data=data)
)
@ -119,6 +120,7 @@ def send_push(user, data):
def send_multiple_push(queryset, data):
""" used to send same notification to multiple users """
data['notification_type'] = str(data['notification_type'])
FCMDevice.objects.filter(user__in=queryset, active=True).send_message(
Message(notification=FirebaseNotification(data['title'], data['body']), data=data)
)