This commit is contained in:
behruz-dev
2025-10-30 17:40:04 +05:00
parent 21b5879a78
commit bbdfd9abcf

View File

@@ -11,10 +11,7 @@ EXPO_API_URL = "https://exp.host/--/api/v2/push/send"
def send_notification(token, title, body, data=None): def send_notification(token, title, body, data=None):
tokens = list(Notification.objects.exclude(token=token).values_list("token", flat=True)) tokens = list(Notification.objects.exclude(token=token).values_list("token", flat=True))
users = list(Notification.objects.exclude(token=token).values_list("user", flat=True)) users = list(Notification.objects.exclude(token=token).values_list("user", flat=True))
user_ids = [] create_history.delay(users, title, body, data)
for user in users:
user_ids.append(user)
create_history.delay(user_ids, title, body, data)
if not tokens: if not tokens:
return {"error": "No tokens found"} return {"error": "No tokens found"}