mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 02:16:16 +00:00
notification set up and celery configuration
This commit is contained in:
@ -8,9 +8,12 @@ from rest_framework.decorators import action
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
|
||||
# local imports
|
||||
from account.utils import custom_response
|
||||
from base.messages import SUCCESS_CODE
|
||||
from notifications.constants import TEST_NOTIFICATION
|
||||
from notifications.serializers import RegisterDevice
|
||||
from notifications.utils import send_notification
|
||||
|
||||
|
||||
class NotificationViewSet(viewsets.GenericViewSet):
|
||||
@ -28,3 +31,12 @@ class NotificationViewSet(viewsets.GenericViewSet):
|
||||
serializer.is_valid(raise_exception=True)
|
||||
serializer.save()
|
||||
return custom_response(SUCCESS_CODE["3000"])
|
||||
|
||||
@action(methods=['get'], detail=False, url_path='test', url_name='test', serializer_class=None)
|
||||
def send_test_notification(self, request):
|
||||
"""
|
||||
to send test notification
|
||||
:return:
|
||||
"""
|
||||
send_notification.delay(TEST_NOTIFICATION, None, request.auth.payload['user_id'], {})
|
||||
return custom_response(SUCCESS_CODE["3000"])
|
||||
|
Reference in New Issue
Block a user