Compare commits

...

30 Commits

Author SHA1 Message Date
8fb627ec03 fixed expire time 2024-03-07 12:40:01 +05:30
c3aa31788f Merge pull request #388 from KiwiTechLLC/ZBKBCK-56
set refresh token time to 365 days
2024-03-06 16:32:16 +05:30
09aecc36b3 set refresh token time to 365 days 2024-03-06 16:21:19 +05:30
348c5946dd token time changed to 1m 2024-03-04 19:32:46 +05:30
5603853896 increased count for version objects 2023-12-11 14:25:24 +05:30
82b7fe7000 updated prod base url 2023-12-07 12:00:16 +05:30
92679061e2 updated frontend prod url 2023-12-06 16:17:41 +05:30
67e4e96d85 added prod link and base url 2023-12-04 17:54:56 +05:30
df32e5ed37 added prod link and base url 2023-12-04 17:05:16 +05:30
e3796f2204 auth token expiry set to 1 min 2023-11-27 12:50:02 +05:30
03f0a4c363 Merge branch 'dev' of https://github.com/KiwiTechLLC/ZODBank-Backend into dev 2023-11-27 12:46:42 +05:30
a3a4a8d091 auth token expiry set to 1 min 2023-11-27 12:43:17 +05:30
772c0c89b5 Merge pull request #369 from KiwiTechLLC/ZBKBCK-56
added optional last name in google login
2023-11-16 17:33:14 +05:30
d614d13136 added optional last name in google login 2023-11-16 17:32:34 +05:30
93ce63b1d4 Merge pull request #366 from KiwiTechLLC/ZBKBCK-56
changed message
2023-11-16 17:08:56 +05:30
4f2b42dc08 changed message 2023-11-16 17:07:46 +05:30
5c05a988a5 new line in faq_json file 2023-11-08 18:54:54 +05:30
2aff4e52f0 Merge pull request #363 from KiwiTechLLC/ZBKBCK-56
modified user notification setting, added optional value for sms notitication as false, added fixture file for faq's
2023-11-08 18:50:38 +05:30
bdc92163c3 added fixture file for faq's 2023-11-08 18:47:28 +05:30
9abf549ed4 modified user notification setting, added optional value for sms notification as false 2023-11-08 15:02:23 +05:30
057c58b709 Merge pull request #360 from KiwiTechLLC/ZBKBCK-55
added status for login and sign up from google and apple
2023-10-27 12:23:25 +05:30
b1d8949b08 added status for login and sign up from google and apple 2023-10-27 12:05:47 +05:30
801bc45bc5 Merge pull request #357 from KiwiTechLLC/ZBKBCK-54
to user type added
2023-10-06 18:12:47 +05:30
012d93f70f Merge pull request #354 from KiwiTechLLC/ZBKBCK-54
added to user type as per required changes, handled apple signup for existing users
2023-10-06 17:55:01 +05:30
652fe9e680 Merge pull request #351 from KiwiTechLLC/ZBKBCK-54
fixed user notificatio setting issue
2023-10-05 17:43:19 +05:30
bf5453c7b7 Merge pull request #348 from KiwiTechLLC/ZBKBCK-54
fixed login into another device issue
2023-10-05 13:24:56 +05:30
47a00f313a Merge pull request #345 from KiwiTechLLC/ZBKBCK-54
added mail for user activation, handled fcm token for deleted user
2023-10-03 18:57:55 +05:30
8050e70cf7 Merge pull request #342 from KiwiTechLLC/ZBKBCK-54
handled deactivated users for social login
2023-09-29 16:11:08 +05:30
f1333491e0 Merge pull request #341 from KiwiTechLLC/ZBKBCK-54
notification mark as read api modified for clear all, list sorting set to updated at field, added same field
2023-09-29 15:09:47 +05:30
4c34c2496b Merge pull request #340 from KiwiTechLLC/ZBKBCK-54
notification create modified to update or create
2023-09-28 19:35:16 +05:30
6 changed files with 149 additions and 15 deletions

View File

@ -216,6 +216,7 @@ class GuardianSerializer(serializers.ModelSerializer):
last_name = serializers.SerializerMethodField('get_last_name')
auth_token = serializers.SerializerMethodField('get_auth_token')
refresh_token = serializers.SerializerMethodField('get_refresh_token')
sign_up = serializers.SerializerMethodField()
def get_auth_token(self, obj):
refresh = RefreshToken.for_user(obj.user)
@ -253,12 +254,16 @@ class GuardianSerializer(serializers.ModelSerializer):
"""user last name"""
return obj.user.last_name
def get_sign_up(self, obj):
return True if self.context.get('sign_up', '') else False
class Meta(object):
"""Meta info"""
model = Guardian
fields = ['id', 'auth_token', 'refresh_token', 'email', 'first_name', 'last_name', 'country_code',
'phone', 'family_name', 'gender', 'dob', 'referral_code', 'is_active', 'is_deleted',
'is_complete_profile', 'passcode', 'image', 'created_at', 'updated_at', 'user_type', 'country_name']
'is_complete_profile', 'passcode', 'image', 'created_at', 'updated_at', 'user_type',
'country_name', 'sign_up']
class JuniorSerializer(serializers.ModelSerializer):
@ -269,6 +274,7 @@ class JuniorSerializer(serializers.ModelSerializer):
last_name = serializers.SerializerMethodField('get_last_name')
auth_token = serializers.SerializerMethodField('get_auth_token')
refresh_token = serializers.SerializerMethodField('get_refresh_token')
sign_up = serializers.SerializerMethodField()
def get_auth_token(self, obj):
refresh = RefreshToken.for_user(obj.auth)
@ -295,13 +301,16 @@ class JuniorSerializer(serializers.ModelSerializer):
def get_last_name(self, obj):
return obj.auth.last_name
def get_sign_up(self, obj):
return True if self.context.get('sign_up', '') else False
class Meta(object):
"""Meta info"""
model = Junior
fields = ['id', 'auth_token', 'refresh_token', 'email', 'first_name', 'last_name', 'country_code',
'phone', 'gender', 'dob', 'guardian_code', 'referral_code','is_active', 'is_password_set',
'is_complete_profile', 'created_at', 'image', 'updated_at', 'user_type', 'country_name','is_invited',
'is_deleted']
'is_deleted', 'sign_up']
class EmailVerificationSerializer(serializers.ModelSerializer):
"""Email verification serializer"""
@ -378,7 +387,7 @@ class UpdateUserNotificationSerializer(serializers.ModelSerializer):
defaults={
'push_notification': validated_data.get('push_notification'),
'email_notification': validated_data.get('email_notification'),
'sms_notification': validated_data.get('sms_notification'),
'sms_notification': validated_data.get('sms_notification', False),
})
return instance

View File

@ -74,7 +74,7 @@ class GoogleLoginMixin(object):
user_info = response.json()
email = user_info['email']
first_name = user_info['given_name']
last_name = user_info['family_name']
last_name = user_info['family_name'] if 'family_name' in user_info and user_info['family_name'] else user_info['given_name']
profile_picture = user_info['picture']
except Exception as e:
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)
@ -129,7 +129,7 @@ class GoogleLoginMixin(object):
junior_code=generate_code(JUN, user_obj.id),
referral_code=generate_code(ZOD, user_obj.id)
)
serializer = JuniorSerializer(junior_query)
serializer = JuniorSerializer(junior_query, context={'sign_up': True})
position = Junior.objects.all().count()
JuniorPoints.objects.create(junior=junior_query, position=position)
elif str(user_type) == '2':
@ -138,7 +138,7 @@ class GoogleLoginMixin(object):
guardian_code=generate_code(GRD, user_obj.id),
referral_code=generate_code(ZOD, user_obj.id)
)
serializer = GuardianSerializer(guardian_query)
serializer = GuardianSerializer(guardian_query, context={'sign_up': True})
else:
user_obj.delete()
return custom_error_response(
@ -220,7 +220,7 @@ class SigninWithApple(views.APIView):
signup_method='3',
junior_code=generate_code(JUN, user.id),
referral_code=generate_code(ZOD, user.id))
serializer = JuniorSerializer(junior_query)
serializer = JuniorSerializer(junior_query, context={'sign_up': True})
position = Junior.objects.all().count()
JuniorPoints.objects.create(junior=junior_query, position=position)
elif str(user_type) == '2':
@ -228,7 +228,7 @@ class SigninWithApple(views.APIView):
signup_method='3',
guardian_code=generate_code(GRD, user.id),
referral_code=generate_code(ZOD, user.id))
serializer = GuardianSerializer(guardian_query)
serializer = GuardianSerializer(guardian_query, context={'sign_up': True})
else:
user.delete()
return custom_error_response(
@ -760,7 +760,7 @@ class ForceUpdateViewSet(GenericViewSet, mixins.CreateModelMixin):
:param kwargs:
:return: success message
"""
if ForceUpdate.objects.all().count() >= 2:
if ForceUpdate.objects.all().count() >= 4:
return custom_error_response(ERROR_CODE['2080'], response_status=status.HTTP_400_BAD_REQUEST)
obj_data = [ForceUpdate(**item) for item in request.data]
try:

View File

@ -96,8 +96,8 @@ ERROR_CODE = {
"2067": "Action not allowed. User type missing.",
"2068": "No guardian associated with this junior",
"2069": "Invalid user type",
"2070": "You do not find as a guardian",
"2071": "You do not find as a junior",
"2070": "You are not registered as a guardian in our system. Please try again as junior.",
"2071": "You are not registered as a junior in our system. Please try again as guardian.",
"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",
"2074": "You can not complete this task because you does not exist in the system",

112
fixtures/faq.json Normal file
View File

@ -0,0 +1,112 @@
[
{
"model": "junior.faq",
"pk": 1,
"fields": {
"question": "What is ZOD ?",
"description": "We are a future neobank for under 18. We aim to provide children with the ability to use debit cards under the watchfull eye of their parents.",
"status": 1,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 2,
"fields": {
"question": "What is financial literacy ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 3,
"fields": {
"question": "How can we win with Zod ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 4,
"fields": {
"question": "What is a budget ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 5,
"fields": {
"question": "What is the difference between stocks and bonds ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 6,
"fields": {
"question": "What is compound interest ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 7,
"fields": {
"question": "What is diversification ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 8,
"fields": {
"question": "What is a 401(k) ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 9,
"fields": {
"question": "What is an emergency fund ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
},
{
"model": "junior.faq",
"pk": 10,
"fields": {
"question": "What is a mortgage ?",
"description": "",
"status": 2,
"created_at": "2023-11-08T12:32:55.291Z",
"updated_at": "2023-11-08T12:32:55.291Z"
}
}
]

View File

@ -19,6 +19,7 @@ from base.pagination import CustomPageNumberPagination
"""Django app import"""
from drf_yasg.utils import swagger_auto_schema
from drf_yasg import openapi
from django.core.management import call_command
from drf_yasg.views import get_schema_view
# Import guardian's model,
# Import junior's model,
@ -813,7 +814,7 @@ class FAQViewSet(GenericViewSet, mixins.CreateModelMixin,
http_method_names = ['get', 'post']
def get_queryset(self):
return FAQ.objects.all()
return FAQ.objects.filter(status=1).order_by('id')
def create(self, request, *args, **kwargs):
"""
@ -823,6 +824,10 @@ class FAQViewSet(GenericViewSet, mixins.CreateModelMixin,
:param kwargs:
:return: success message
"""
load_fixture = request.query_params.get('load_fixture')
if load_fixture:
call_command('loaddata', 'fixtures/faq.json')
return custom_response(SUCCESS_CODE["3045"], response_status=status.HTTP_200_OK)
obj_data = [FAQ(**item) for item in request.data]
try:
FAQ.objects.bulk_create(obj_data)

View File

@ -56,7 +56,14 @@ if ENV in ['dev', 'qa', 'stage']:
# Add more trusted origins as needed
]
if ENV == "prod":
CORS_ALLOWED_ORIGINS = []
CORS_ALLOWED_ORIGINS = [
# backend base url
"https://prod-api.zodbank.com",
# frontend url
"https://web.zodbank.com",
# Add more trusted origins as needed
]
# allow all host
ALLOWED_HOSTS = ['*']
@ -138,9 +145,10 @@ REST_FRAMEWORK = {
# define jwt token
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(hours=2, minutes=59, seconds=59, microseconds=999999),
'REFRESH_TOKEN_LIFETIME': timedelta(hours=71, minutes=59, seconds=59, microseconds=999999),
'REFRESH_TOKEN_LIFETIME': timedelta(days=364, hours=23, minutes=59, seconds=59, microseconds=999999),
}
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
@ -200,7 +208,7 @@ AUTH_PASSWORD_VALIDATORS = [
# database query logs settings
# Allows us to check db hits
# useful to optimize db query and hit
LOGGING = {
LOGGING1 = {
"version": 1,
"filters": {
"require_debug_true": {