fixes of broken fucntions
This commit is contained in:
@@ -194,6 +194,26 @@ class AccountModelViewSet(viewsets.ModelViewSet):
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
request=request
|
||||
)
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""
|
||||
Override list to return unified format
|
||||
"""
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
|
||||
# Check if pagination is enabled
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None:
|
||||
serializer = self.get_serializer(page, many=True)
|
||||
# Use paginator's get_paginated_response which already returns unified format
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
# No pagination - return all results in unified format
|
||||
serializer = self.get_serializer(queryset, many=True)
|
||||
return success_response(
|
||||
data=serializer.data,
|
||||
request=request
|
||||
)
|
||||
|
||||
|
||||
class SiteSectorModelViewSet(AccountModelViewSet):
|
||||
|
||||
@@ -12,6 +12,7 @@ from igny8_core.api.base import SiteSectorModelViewSet
|
||||
from igny8_core.api.pagination import CustomPageNumberPagination
|
||||
from igny8_core.api.response import success_response, error_response
|
||||
from igny8_core.api.throttles import DebugScopedRateThrottle
|
||||
from igny8_core.api.permissions import IsAuthenticatedAndActive, IsViewerOrAbove, IsEditorOrAbove
|
||||
from .models import Keywords, Clusters, ContentIdeas
|
||||
from .serializers import KeywordSerializer, ContentIdeasSerializer
|
||||
from .cluster_serializers import ClusterSerializer
|
||||
@@ -25,7 +26,7 @@ class KeywordViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
queryset = Keywords.objects.all()
|
||||
serializer_class = KeywordSerializer
|
||||
permission_classes = [] # Allow any for now
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
pagination_class = CustomPageNumberPagination # Explicitly use custom pagination
|
||||
throttle_scope = 'planner'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
@@ -668,6 +669,7 @@ class ClusterViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
queryset = Clusters.objects.all()
|
||||
serializer_class = ClusterSerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
pagination_class = CustomPageNumberPagination # Explicitly use custom pagination
|
||||
throttle_scope = 'planner'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
@@ -957,6 +959,7 @@ class ContentIdeasViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
queryset = ContentIdeas.objects.all()
|
||||
serializer_class = ContentIdeasSerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
pagination_class = CustomPageNumberPagination
|
||||
throttle_scope = 'planner'
|
||||
throttle_classes = [DebugScopedRateThrottle] # Explicitly use custom pagination
|
||||
|
||||
@@ -10,6 +10,7 @@ from django.db import transaction
|
||||
from igny8_core.api.base import AccountModelViewSet
|
||||
from igny8_core.api.response import success_response, error_response
|
||||
from igny8_core.api.throttles import DebugScopedRateThrottle
|
||||
from igny8_core.api.permissions import IsAuthenticatedAndActive, IsAdminOrOwner
|
||||
from django.conf import settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -21,7 +22,7 @@ class IntegrationSettingsViewSet(viewsets.ViewSet):
|
||||
Following reference plugin pattern: WordPress uses update_option() for igny8_api_settings
|
||||
We store in IntegrationSettings model with account isolation
|
||||
"""
|
||||
permission_classes = [] # Allow any for now
|
||||
permission_classes = [IsAuthenticatedAndActive, IsAdminOrOwner]
|
||||
|
||||
throttle_scope = 'system_admin'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
|
||||
@@ -14,7 +14,7 @@ from django.utils import timezone
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from igny8_core.api.base import AccountModelViewSet
|
||||
from igny8_core.api.response import success_response, error_response
|
||||
from igny8_core.api.permissions import IsEditorOrAbove
|
||||
from igny8_core.api.permissions import IsEditorOrAbove, IsAuthenticatedAndActive, IsViewerOrAbove
|
||||
from igny8_core.api.throttles import DebugScopedRateThrottle
|
||||
from igny8_core.api.pagination import CustomPageNumberPagination
|
||||
from .models import AIPrompt, AuthorProfile, Strategy
|
||||
@@ -199,6 +199,7 @@ class AuthorProfileViewSet(AccountModelViewSet):
|
||||
"""
|
||||
queryset = AuthorProfile.objects.all()
|
||||
serializer_class = AuthorProfileSerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
throttle_scope = 'system'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
|
||||
@@ -216,6 +217,7 @@ class StrategyViewSet(AccountModelViewSet):
|
||||
"""
|
||||
queryset = Strategy.objects.all()
|
||||
serializer_class = StrategySerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
throttle_scope = 'system'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from igny8_core.api.base import SiteSectorModelViewSet
|
||||
from igny8_core.api.pagination import CustomPageNumberPagination
|
||||
from igny8_core.api.response import success_response, error_response
|
||||
from igny8_core.api.throttles import DebugScopedRateThrottle
|
||||
from igny8_core.api.permissions import IsAuthenticatedAndActive, IsViewerOrAbove, IsEditorOrAbove
|
||||
from .models import Tasks, Images, Content
|
||||
from .serializers import TasksSerializer, ImagesSerializer, ContentSerializer
|
||||
|
||||
@@ -19,6 +20,7 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
queryset = Tasks.objects.select_related('content_record')
|
||||
serializer_class = TasksSerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
pagination_class = CustomPageNumberPagination # Explicitly use custom pagination
|
||||
throttle_scope = 'writer'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
@@ -379,6 +381,7 @@ class ImagesViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
queryset = Images.objects.all()
|
||||
serializer_class = ImagesSerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
pagination_class = CustomPageNumberPagination
|
||||
throttle_scope = 'writer'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
@@ -777,6 +780,7 @@ class ContentViewSet(SiteSectorModelViewSet):
|
||||
"""
|
||||
queryset = Content.objects.all()
|
||||
serializer_class = ContentSerializer
|
||||
permission_classes = [IsAuthenticatedAndActive, IsViewerOrAbove]
|
||||
pagination_class = CustomPageNumberPagination
|
||||
throttle_scope = 'writer'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
|
||||
Reference in New Issue
Block a user