mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-17 10:55:09 +00:00
swagger update
This commit is contained in:
@ -13,7 +13,9 @@ import requests
|
||||
|
||||
from rest_framework.viewsets import GenericViewSet, mixins
|
||||
"""Django app import"""
|
||||
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from drf_yasg import openapi
|
||||
from drf_yasg.views import get_schema_view
|
||||
# Import guardian's model,
|
||||
# Import junior's model,
|
||||
# Import account's model,
|
||||
@ -99,7 +101,7 @@ class UpdateJuniorProfile(viewsets.ModelViewSet):
|
||||
except Exception as e:
|
||||
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
class ValidateGuardianCode(viewsets.ViewSet):
|
||||
class ValidateGuardianCode(viewsets.ModelViewSet):
|
||||
"""Check guardian code exist or not"""
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@ -156,7 +158,14 @@ class AddJuniorAPIView(viewsets.ModelViewSet):
|
||||
http_method_names = ('post',)
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
""" junior list"""
|
||||
""" add junior
|
||||
{ "gender":"1",
|
||||
"first_name":"abc",
|
||||
"last_name":"xyz",
|
||||
"dob":"2023-12-12",
|
||||
"relationship":"2",
|
||||
"email":"abc@yopmail.com"
|
||||
}"""
|
||||
try:
|
||||
info_data = {'user': request.user, 'relationship': str(request.data['relationship']),
|
||||
'email': request.data['email'], 'first_name': request.data['first_name'],
|
||||
@ -235,12 +244,25 @@ class InvitedJuniorAPIView(viewsets.ModelViewSet):
|
||||
|
||||
|
||||
class FilterJuniorAPIView(viewsets.ModelViewSet):
|
||||
"""Update guardian profile"""
|
||||
"""filter junior profile"""
|
||||
serializer_class = JuniorDetailListSerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
pagination_class = PageNumberPagination
|
||||
http_method_names = ('get',)
|
||||
|
||||
@swagger_auto_schema(
|
||||
manual_parameters=[
|
||||
# Example of a query parameter
|
||||
openapi.Parameter(
|
||||
'title', # Query parameter name
|
||||
openapi.IN_QUERY, # Parameter location
|
||||
description='title of the name',
|
||||
type=openapi.TYPE_STRING, # Parameter type
|
||||
),
|
||||
# Add more parameters as needed
|
||||
]
|
||||
)
|
||||
|
||||
def get_queryset(self):
|
||||
"""Get the queryset for the view"""
|
||||
title = self.request.GET.get('title')
|
||||
@ -386,7 +408,7 @@ class JuniorPointsListAPIView(viewsets.ModelViewSet):
|
||||
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
class ValidateReferralCode(viewsets.ViewSet):
|
||||
class ValidateReferralCode(viewsets.ModelViewSet):
|
||||
"""Check guardian code exist or not"""
|
||||
permission_classes = [IsAuthenticated]
|
||||
http_method_names = ('get',)
|
||||
@ -421,7 +443,13 @@ class InviteGuardianAPIView(viewsets.ModelViewSet):
|
||||
permission_classes = [IsAuthenticated]
|
||||
http_method_names = ('post',)
|
||||
def create(self, request, *args, **kwargs):
|
||||
""" junior list"""
|
||||
""" add guardian
|
||||
{
|
||||
"first_name":"abc",
|
||||
"last_name":"xyz",
|
||||
"email":"abc@yopmail.com",
|
||||
"relationship":2
|
||||
}"""
|
||||
try:
|
||||
if request.data['email'] == '':
|
||||
return custom_error_response(ERROR_CODE['2062'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
Reference in New Issue
Block a user