mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 18:07:02 +00:00
handle deleted user scenario in complete task api
This commit is contained in:
@ -99,7 +99,8 @@ ERROR_CODE = {
|
|||||||
"2070": "You did not find as a guardian",
|
"2070": "You did not find as a guardian",
|
||||||
"2071": "You did not find as a junior",
|
"2071": "You did not find as a junior",
|
||||||
"2072": "You can not approve or reject this task because junior does not exist in the system",
|
"2072": "You can not approve or reject this task because junior does not exist in the system",
|
||||||
"2073": "You can not approve or reject this junior because junior does not exist in the system"
|
"2073": "You can not approve or reject this junior because junior does not exist in the system",
|
||||||
|
"2074": "You can not complete this task because you does not exist in the system"
|
||||||
|
|
||||||
}
|
}
|
||||||
"""Success message code"""
|
"""Success message code"""
|
||||||
|
@ -339,6 +339,8 @@ class CompleteJuniorTaskAPIView(views.APIView):
|
|||||||
task_queryset = JuniorTask.objects.filter(id=task_id, junior__auth__email=self.request.user
|
task_queryset = JuniorTask.objects.filter(id=task_id, junior__auth__email=self.request.user
|
||||||
).select_related('guardian', 'junior').last()
|
).select_related('guardian', 'junior').last()
|
||||||
if task_queryset:
|
if task_queryset:
|
||||||
|
if task_queryset.junior.is_deleted:
|
||||||
|
return custom_error_response(ERROR_CODE['2074'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||||
# use CompleteTaskSerializer serializer
|
# use CompleteTaskSerializer serializer
|
||||||
if task_queryset.task_status in [str(NUMBER['four']), str(NUMBER['five'])]:
|
if task_queryset.task_status in [str(NUMBER['four']), str(NUMBER['five'])]:
|
||||||
"""Already request send """
|
"""Already request send """
|
||||||
|
Reference in New Issue
Block a user