notification: add firebase notification to web

This commit is contained in:
behruz-dev
2025-10-30 14:59:59 +05:00
parent b6b2875e0d
commit 9b4f343f77
10 changed files with 198 additions and 79 deletions

View File

@@ -1,8 +1,11 @@
from core.apps.notifications.models import Notification
from core.apps.notifications.utils.send_notification import send_notification
from core.apps.notifications.utils.send_notification import send_notification, send_web_notification
def notify_user(user, title, body, data):
tokens = Notification.objects.filter(user=user)
for token in tokens:
send_notification(token.token, title, body, data)
if token.type == 'mobile':
send_notification(token.token, title, body, data)
if token.type == 'web':
send_web_notification(token.token, title, body, data)