mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 18:07:02 +00:00
sonar fixes
This commit is contained in:
@ -41,7 +41,7 @@ from .utils import delete_user_account_condition_social, delete_user_account_con
|
||||
# email verification serializer,
|
||||
# phone otp serializer
|
||||
|
||||
|
||||
# create all serializer here
|
||||
class GoogleLoginSerializer(serializers.Serializer):
|
||||
"""google login serializer"""
|
||||
access_token = serializers.CharField(max_length=5000, required=True)
|
||||
|
@ -50,6 +50,7 @@ ERROR_CODE = {
|
||||
# email not verified
|
||||
"2024": "Email not verified",
|
||||
"2025": "Invalid input. Expected a list of strings.",
|
||||
# check old and new password
|
||||
"2026": "New password should not same as old password",
|
||||
"2027": "data should contain `identityToken`",
|
||||
"2028": "You are not authorized person to sign up on this platform",
|
||||
@ -66,8 +67,10 @@ ERROR_CODE = {
|
||||
# log in multiple device msg
|
||||
"2037": "You are already log in another device",
|
||||
"2038": "Choose valid action for task",
|
||||
# card length limit
|
||||
"2039": "Add at least one article card or maximum 6",
|
||||
"2040": "Add at least 5 article survey or maximum 10",
|
||||
# add article msg
|
||||
"2041": "Article with given id doesn't exist.",
|
||||
"2042": "Article Card with given id doesn't exist.",
|
||||
"2043": "Article Survey with given id doesn't exist."
|
||||
|
@ -321,14 +321,18 @@ class ApproveTaskSerializer(serializers.ModelSerializer):
|
||||
# approve the task
|
||||
instance.task_status = str(NUMBER['five'])
|
||||
instance.is_approved = True
|
||||
# update total task point
|
||||
junior_data.total_task_points = junior_data.total_task_points + instance.points
|
||||
# update complete time of task
|
||||
instance.completed_on = datetime.today()
|
||||
junior_data.save()
|
||||
else:
|
||||
# reject the task
|
||||
instance.task_status = str(NUMBER['three'])
|
||||
instance.is_approved = False
|
||||
# update total task point
|
||||
junior_data.total_task_points = junior_data.total_task_points - instance.points
|
||||
# update reject time of task
|
||||
instance.rejected_on = datetime.today()
|
||||
junior_data.save()
|
||||
instance.save()
|
||||
|
@ -39,6 +39,7 @@ def upload_image_to_alibaba(image, filename):
|
||||
return f"https://{settings.ALIYUN_OSS_BUCKET_NAME}.{settings.ALIYUN_OSS_ENDPOINT}/{new_filename}"
|
||||
|
||||
def real_time():
|
||||
""" real time """
|
||||
# Fetch real time.
|
||||
# time is not depend on system time
|
||||
# Get the current datetime
|
||||
@ -49,6 +50,7 @@ def real_time():
|
||||
return current_datetime
|
||||
|
||||
def convert_timedelta_into_datetime(time_difference):
|
||||
"""convert date time"""
|
||||
# convert timedelta into datetime format
|
||||
hours = time_difference.seconds // NUMBER['thirty_six_hundred']
|
||||
minutes = (time_difference.seconds // NUMBER['sixty']) % NUMBER['sixty']
|
||||
|
@ -19,6 +19,7 @@ from django.utils import timezone
|
||||
# Import account's serializer
|
||||
# Import account's task
|
||||
|
||||
|
||||
from .serializers import (UserSerializer, CreateGuardianSerializer, TaskSerializer, TaskDetailsSerializer,
|
||||
TopJuniorSerializer, ApproveJuniorSerializer, ApproveTaskSerializer)
|
||||
from .models import Guardian, JuniorTask
|
||||
@ -42,6 +43,7 @@ from .utils import upload_image_to_alibaba
|
||||
# approve junior API
|
||||
# approve task API
|
||||
# Create your views here.
|
||||
# create approve task API
|
||||
class SignupViewset(viewsets.ModelViewSet):
|
||||
"""Signup view set"""
|
||||
queryset = User.objects.all()
|
||||
@ -197,6 +199,7 @@ class TopJuniorListAPIView(viewsets.ModelViewSet):
|
||||
queryset = JuniorPoints.objects.all()
|
||||
|
||||
def get_serializer_context(self):
|
||||
# context list
|
||||
context = super().get_serializer_context()
|
||||
context.update({'view': self})
|
||||
return context
|
||||
|
@ -51,6 +51,8 @@ jmespath==0.10.0
|
||||
kombu==5.3.1
|
||||
MarkupSafe==2.1.3
|
||||
msgpack==1.0.5
|
||||
ntplib==0.4.0
|
||||
numpy==1.25.1
|
||||
oss2==2.18.0
|
||||
packaging==23.1
|
||||
phonenumbers==8.13.15
|
||||
|
Reference in New Issue
Block a user