Backend Draft

This commit is contained in:
__init__
2026-02-23 20:31:53 +05:30
commit eec700af51
127 changed files with 2356 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
from celery import shared_task
from django.contrib.auth import get_user_model
from dashboard.models import Notification
from tenants.models import Tenant
User = get_user_model()
@shared_task
def send_notification_email_async(notification_id):
"""
Example Celery task to asynchronously send an email
when a new notification is generated.
"""
try:
notification = Notification.objects.get(id=notification_id)
user = notification.user
# In a real scenario, this would use django.core.mail.send_mail
print(f"ASYNC TASK: Sending email to {user.email} regarding: {notification.title}")
return True
except Notification.DoesNotExist:
print(f"ASYNC TASK ERR: Notification {notification_id} not found.")
return False