Enhance API structure and documentation: Added new tags for Account, Integration, Automation, Linker, Optimizer, and Publisher; updated billing endpoints for admin and customer; improved API reference documentation; fixed endpoint paths in frontend services.
This commit is contained in:
@@ -6,6 +6,7 @@ from rest_framework import status
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
from django.utils import timezone
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view
|
||||
|
||||
from igny8_core.api.base import SiteSectorModelViewSet
|
||||
from igny8_core.api.permissions import IsAuthenticatedAndActive, IsEditorOrAbove
|
||||
@@ -21,6 +22,14 @@ import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
list=extend_schema(tags=['Integration']),
|
||||
create=extend_schema(tags=['Integration']),
|
||||
retrieve=extend_schema(tags=['Integration']),
|
||||
update=extend_schema(tags=['Integration']),
|
||||
partial_update=extend_schema(tags=['Integration']),
|
||||
destroy=extend_schema(tags=['Integration']),
|
||||
)
|
||||
class IntegrationViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
ViewSet for SiteIntegration model.
|
||||
@@ -88,6 +97,7 @@ class IntegrationViewSet(SiteSectorModelViewSet):
|
||||
|
||||
return SiteIntegrationSerializer
|
||||
|
||||
@extend_schema(tags=['Integration'])
|
||||
@action(detail=True, methods=['post'])
|
||||
def test_connection(self, request, pk=None):
|
||||
"""
|
||||
@@ -118,6 +128,7 @@ class IntegrationViewSet(SiteSectorModelViewSet):
|
||||
def allow_request(self, request, view):
|
||||
return True
|
||||
|
||||
@extend_schema(tags=['Integration'])
|
||||
@action(detail=False, methods=['post'], url_path='test-connection',
|
||||
permission_classes=[AllowAny], throttle_classes=[NoThrottle])
|
||||
def test_connection_collection(self, request):
|
||||
@@ -221,6 +232,7 @@ class IntegrationViewSet(SiteSectorModelViewSet):
|
||||
logger.info(f"[IntegrationViewSet] Deleted integration {integration.id} due to failed connection test")
|
||||
return error_response(result.get('message', 'Connection test failed'), None, status.HTTP_400_BAD_REQUEST, request)
|
||||
|
||||
@extend_schema(tags=['Integration'])
|
||||
@action(detail=True, methods=['post'])
|
||||
def sync(self, request, pk=None):
|
||||
"""
|
||||
@@ -252,6 +264,7 @@ class IntegrationViewSet(SiteSectorModelViewSet):
|
||||
response_status = status.HTTP_200_OK if result.get('success') else status.HTTP_400_BAD_REQUEST
|
||||
return success_response(result, request=request, status_code=response_status)
|
||||
|
||||
@extend_schema(tags=['Integration'])
|
||||
@action(detail=True, methods=['get'])
|
||||
def sync_status(self, request, pk=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user