refactor(fns): переместить роуты /api/v1/parsers/fns → /api/v1/fns
- Упростить URL: /api/v1/fns/reports/, /api/v1/fns/upload/ - Добавить swagger теги для группировки в документации
This commit is contained in:
@@ -13,12 +13,15 @@ from apps.parsers.serializers import (
|
||||
)
|
||||
from apps.parsers.tasks import process_fns_file
|
||||
from django.conf import settings
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from rest_framework import status
|
||||
from rest_framework.parsers import MultiPartParser
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.viewsets import ReadOnlyModelViewSet
|
||||
|
||||
FNS_TAG = "ФНС - Бухгалтерская отчетность"
|
||||
|
||||
|
||||
class FinancialReportViewSet(ReadOnlyModelViewSet):
|
||||
"""
|
||||
@@ -40,6 +43,14 @@ class FinancialReportViewSet(ReadOnlyModelViewSet):
|
||||
return FinancialReportDetailSerializer
|
||||
return FinancialReportSerializer
|
||||
|
||||
@swagger_auto_schema(tags=[FNS_TAG])
|
||||
def list(self, request, *args, **kwargs):
|
||||
return super().list(request, *args, **kwargs)
|
||||
|
||||
@swagger_auto_schema(tags=[FNS_TAG])
|
||||
def retrieve(self, request, *args, **kwargs):
|
||||
return super().retrieve(request, *args, **kwargs)
|
||||
|
||||
|
||||
class FNSReportUploadView(APIView):
|
||||
"""
|
||||
@@ -63,6 +74,7 @@ class FNSReportUploadView(APIView):
|
||||
|
||||
parser_classes = [MultiPartParser]
|
||||
|
||||
@swagger_auto_schema(tags=[FNS_TAG], request_body=FNSFileUploadSerializer)
|
||||
def post(self, request):
|
||||
serializer = FNSFileUploadSerializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
|
||||
Reference in New Issue
Block a user