schon/vibes_auth/tasks.py
Egor fureunoir Gorbunov 7722eef0a3 Features: 1) Added custom queues to all Celery tasks for more granular processing; 2) Implemented sensitive data scrubbing in Sentry error reporting.
Fixes: None;

Extra: Refactored Sentry initialization to include `before_send` callback and improved settings structure.
2025-07-02 15:36:52 +03:00

24 lines
766 B
Python

from celery import shared_task
from core.models import Order, Wishlist
from vibes_auth.models import User
@shared_task(queue="default")
def create_pending_order(user_uuid):
try:
user = User.objects.get(uuid=user_uuid)
Order.objects.create(user=user, status="PENDING")
return True, f"Successfully created order for {user_uuid}"
except User.DoesNotExist:
return False, f"Bad uuid was given: {user_uuid}"
@shared_task(queue="default")
def create_wishlist(user_uuid):
try:
user = User.objects.get(uuid=user_uuid)
Wishlist.objects.create(user=user)
return True, f"Successfully created wishlist for {user_uuid}"
except User.DoesNotExist:
return False, f"Bad uuid was given: {user_uuid}"