mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 08:34:55 +00:00
jira-7 changes in requirment.txt file
This commit is contained in:
11
zod_bank/Dockerfile
Normal file
11
zod_bank/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM python:3.9
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
RUN mkdir /usr/src/app
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY . .
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install wkhtmltopdf -y
|
||||||
|
RUN apt install -y gdal-bin python3-gdal
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ from rest_framework_simplejwt.tokens import RefreshToken
|
|||||||
from base.messages import ERROR_CODE, SUCCESS_CODE
|
from base.messages import ERROR_CODE, SUCCESS_CODE
|
||||||
from guardian.tasks import generate_otp
|
from guardian.tasks import generate_otp
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from account.utils import send_otp_email
|
||||||
from account.utils import custom_response, custom_error_response
|
from account.utils import custom_response, custom_error_response
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
@ -27,7 +28,7 @@ class ChangePasswordAPIView(views.APIView):
|
|||||||
serializer = ChangePasswordSerializer(context=request.user, data=request.data)
|
serializer = ChangePasswordSerializer(context=request.user, data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
serializer.save()
|
serializer.save()
|
||||||
return custom_response(SUCCESS_CODE['3006'], response_status=status.HTTP_200_OK)
|
return custom_response(SUCCESS_CODE['3007'], response_status=status.HTTP_200_OK)
|
||||||
return custom_error_response(serializer.errors, response_status=status.HTTP_400_BAD_REQUEST)
|
return custom_error_response(serializer.errors, response_status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
class ResetPasswordAPIView(views.APIView):
|
class ResetPasswordAPIView(views.APIView):
|
||||||
@ -59,11 +60,11 @@ class ForgotPasswordAPIView(views.APIView):
|
|||||||
'verification_code': verification_code
|
'verification_code': verification_code
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
user_data = UserEmailOtp.objects.get_or_create(email=email)
|
user_data, created = UserEmailOtp.objects.get_or_create(email=email)
|
||||||
if user_data:
|
if user_data:
|
||||||
user_data.otp = verification_code
|
user_data.otp = verification_code
|
||||||
user_data.save()
|
user_data.save()
|
||||||
return custom_response(SUCCESS_CODE['3015'], {'verification_code': verification_code},
|
return custom_response(SUCCESS_CODE['3015'],
|
||||||
response_status=status.HTTP_200_OK)
|
response_status=status.HTTP_200_OK)
|
||||||
return custom_error_response(serializer.errors, response_status=status.HTTP_400_BAD_REQUEST)
|
return custom_error_response(serializer.errors, response_status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
@ -86,8 +87,8 @@ class UserPhoneVerification(viewsets.ModelViewSet):
|
|||||||
"""Send otp on phone"""
|
"""Send otp on phone"""
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
phone_data = UserPhoneOtp.objects.filter(phone=request.data['phone'],
|
phone_data = UserPhoneOtp.objects.filter(phone=self.request.GET.get('phone'),
|
||||||
otp=request.data['otp']).last()
|
otp=self.request.GET.get('otp')).last()
|
||||||
if phone_data:
|
if phone_data:
|
||||||
phone_data.is_verified = True
|
phone_data.is_verified = True
|
||||||
phone_data.save()
|
phone_data.save()
|
||||||
@ -165,8 +166,8 @@ class UserEmailVerification(viewsets.ModelViewSet):
|
|||||||
|
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
email_data = UserEmailOtp.objects.filter(email=request.data['email'],
|
email_data = UserEmailOtp.objects.filter(email=self.request.GET.get('email'),
|
||||||
otp=request.data['otp']).last()
|
otp=self.request.GET.get('otp')).last()
|
||||||
if email_data:
|
if email_data:
|
||||||
email_data.is_verified = True
|
email_data.is_verified = True
|
||||||
email_data.save()
|
email_data.save()
|
||||||
@ -182,11 +183,12 @@ class ReSendEmailOtp(viewsets.ModelViewSet):
|
|||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
otp = generate_otp()
|
otp = generate_otp()
|
||||||
if User.objects.filter(email=request.data['email']):
|
if User.objects.filter(email=request.data['email']):
|
||||||
email_data = UserEmailOtp.objects.get_or_create(email=request.data['email'])
|
email_data, created = UserEmailOtp.objects.get_or_create(email=request.data['email'])
|
||||||
if email_data:
|
if email_data:
|
||||||
email_data.otp = otp
|
email_data.otp = otp
|
||||||
email_data.save()
|
email_data.save()
|
||||||
return custom_response(None, {'email_otp': otp}, response_status=status.HTTP_200_OK)
|
send_otp_email(request.data['email'], otp)
|
||||||
|
return custom_response(SUCCESS_CODE['3016'], response_status=status.HTTP_200_OK)
|
||||||
else:
|
else:
|
||||||
return custom_error_response(ERROR_CODE["2023"], response_status=status.HTTP_400_BAD_REQUEST)
|
return custom_error_response(ERROR_CODE["2023"], response_status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ SUCCESS_CODE = {
|
|||||||
# Success code for password reset
|
# Success code for password reset
|
||||||
"3006": "Your password has been reset successfully.",
|
"3006": "Your password has been reset successfully.",
|
||||||
# Success code for password update
|
# Success code for password update
|
||||||
"3007": "Your password has been updated successfully.",
|
"3007": "Your password has been changed successfully.",
|
||||||
# Success code for valid link
|
# Success code for valid link
|
||||||
"3008": "You have a valid link.",
|
"3008": "You have a valid link.",
|
||||||
# Success code for logged out
|
# Success code for logged out
|
||||||
@ -74,7 +74,8 @@ SUCCESS_CODE = {
|
|||||||
"3012": "Phone OTP Verified successfully",
|
"3012": "Phone OTP Verified successfully",
|
||||||
"3013": "Valid Guardian code",
|
"3013": "Valid Guardian code",
|
||||||
"3014": "Password has been updated successfully.",
|
"3014": "Password has been updated successfully.",
|
||||||
"3015": "Verification code sent on your email."
|
"3015": "Verification code sent on your email.",
|
||||||
|
"3016": "Send otp on your Email successfully"
|
||||||
}
|
}
|
||||||
|
|
||||||
STATUS_CODE_ERROR = {
|
STATUS_CODE_ERROR = {
|
||||||
|
|||||||
18
zod_bank/docker-compose.yml
Normal file
18
zod_bank/docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
container_name: nginx
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- ./nginx:/etc/nginx/conf.d
|
||||||
|
- .:/usr/src/app
|
||||||
|
depends_on:
|
||||||
|
- web
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
container_name: django
|
||||||
|
command: bash -c "pip install -r requirements.txt && python manage.py collectstatic --noinput && python manage.py migrate && gunicorn zod_bank.wsgi -b 0.0.0.0:8000 -t 300 --log-level=info"
|
||||||
|
volumes:
|
||||||
|
- .:/usr/src/app
|
||||||
@ -31,10 +31,10 @@ class ValidateGuardianCode(viewsets.ViewSet):
|
|||||||
|
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
"""check guardian code"""
|
"""check guardian code"""
|
||||||
guardian_code = request.data.get('guardian_code')
|
guardian_code = self.request.GET.get('guardian_code').split(',')
|
||||||
for code in guardian_code:
|
for code in guardian_code:
|
||||||
guardian_data = Guardian.objects.filter(guardian_code=code).exists()
|
guardian_data = Guardian.objects.filter(guardian_code=code).exists()
|
||||||
if guardian_data:
|
if guardian_data:
|
||||||
return custom_response(SUCCESS_CODE['3028'], response_status=status.HTTP_200_OK)
|
return custom_response(SUCCESS_CODE['3013'], response_status=status.HTTP_200_OK)
|
||||||
else:
|
else:
|
||||||
return custom_error_response(ERROR_CODE["2022"], response_status=status.HTTP_400_BAD_REQUEST)
|
return custom_error_response(ERROR_CODE["2022"], response_status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|||||||
@ -33,6 +33,7 @@ django-timezone-field==5.1
|
|||||||
djangorestframework==3.14.0
|
djangorestframework==3.14.0
|
||||||
djangorestframework-simplejwt==5.2.2
|
djangorestframework-simplejwt==5.2.2
|
||||||
drf-yasg==1.21.6
|
drf-yasg==1.21.6
|
||||||
|
gunicorn==20.1.0
|
||||||
inflection==0.5.1
|
inflection==0.5.1
|
||||||
jmespath==0.10.0
|
jmespath==0.10.0
|
||||||
kombu==5.3.1
|
kombu==5.3.1
|
||||||
|
|||||||
Reference in New Issue
Block a user