jira-16 filter, invite and remove API

This commit is contained in:
jain
2023-07-12 19:32:10 +05:30
parent a041028840
commit 1fc02d17e6
9 changed files with 137 additions and 34 deletions

View File

@ -86,11 +86,21 @@ class GoogleLoginMixin:
user_obj = User.objects.create(username=email, email=email, first_name=first_name, last_name=last_name)
if str(user_type) == '1':
junior_query = Junior.objects.create(auth=user_obj, is_verified=True, is_active=True,
image=profile_picture, signup_method='2')
image=profile_picture, signup_method='2',
junior_code=''.join(
[str(random.randrange(9)) for _ in range(6)]),
referral_code=''.join(
[str(random.randrange(9)) for _ in range(6)])
)
serializer = JuniorSerializer(junior_query)
if str(user_type) == '2':
guardian_query = Guardian.objects.create(user=user_obj, is_verified=True, is_active=True,
image=profile_picture,signup_method='2')
image=profile_picture,signup_method='2',
guardian_code=''.join(
[str(random.randrange(9)) for _ in range(6)]),
referral_code=''.join(
[str(random.randrange(9)) for _ in range(6)])
)
serializer = GuardianSerializer(guardian_query)
# Return a JSON response with the user's email and name
return custom_response(SUCCESS_CODE['3003'], serializer.data,
@ -131,11 +141,18 @@ class SigninWithApple(views.APIView):
user = User.objects.create(**user_data)
if str(user_type) == '1':
junior_query = Junior.objects.create(auth=user, is_verified=True, is_active=True,
signup_method='3')
signup_method='3',junior_code=''.join(
[str(random.randrange(9)) for _ in range(6)]),
referral_code=''.join(
[str(random.randrange(9)) for _ in range(6)]))
serializer = JuniorSerializer(junior_query)
if str(user_type) == '2':
guardian_query = Guardian.objects.create(user=user, is_verified=True, is_active=True,
signup_method='3')
signup_method='3',
guardian_code=''.join(
[str(random.randrange(9)) for _ in range(6)]),
referral_code=''.join(
[str(random.randrange(9)) for _ in range(6)]))
serializer = GuardianSerializer(guardian_query)
return custom_response(SUCCESS_CODE['3003'], serializer.data,
response_status=status.HTTP_200_OK)
@ -442,7 +459,6 @@ class DeleteUserProfileAPIViewSet(viewsets.GenericViewSet):
user_type = str(request.data['user_type'])
password = request.data.get('password')
signup_method = str(request.data.get('signup_method'))
print("signup_method===>",signup_method,'==>',type(signup_method))
serializer = self.get_serializer(data=request.data, context={'request': request, 'user': request.user,
'user_type': user_type,
'password': password,