notification app, api for device registration and fcm token

This commit is contained in:
abutalib-kiwi
2023-07-18 14:06:04 +05:30
parent 04342133ef
commit ba4d5933de
15 changed files with 142 additions and 1 deletions

17
notifications/utils.py Normal file
View File

@ -0,0 +1,17 @@
"""
notifications utils file
"""
# third party imports
from fcm_django.models import FCMDevice
# local imports
def register_fcm_token(user_id, registration_id, device_id, device_type):
""" used to register the fcm device token"""
device, _ = FCMDevice.objects.update_or_create(device_id=device_id,
defaults={'user_id': user_id, 'type': device_type,
'active': True,
'registration_id': registration_id})
return device