From d47efaa0f0f752693759eae9363f7b5a1ab9a863 Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Mon, 25 Sep 2023 16:51:59 +0530 Subject: [PATCH] dev: remove auto filter endpoint --- apiserver/plane/api/urls.py | 6 ---- apiserver/plane/api/views/__init__.py | 2 +- apiserver/plane/api/views/view.py | 45 -------------------------- apiserver/plane/utils/issue_filters.py | 4 --- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/apiserver/plane/api/urls.py b/apiserver/plane/api/urls.py index c10c4a745..771c131ed 100644 --- a/apiserver/plane/api/urls.py +++ b/apiserver/plane/api/urls.py @@ -105,7 +105,6 @@ from plane.api.views import ( GlobalViewViewSet, GlobalViewIssuesViewSet, IssueViewViewSet, - ViewIssuesEndpoint, IssueViewFavoriteViewSet, ## End Views # Cycles @@ -649,11 +648,6 @@ urlpatterns = [ ), name="project-view", ), - path( - "workspaces//projects//views//issues/", - ViewIssuesEndpoint.as_view(), - name="project-view-issues", - ), path( "workspaces//views/", GlobalViewViewSet.as_view( diff --git a/apiserver/plane/api/views/__init__.py b/apiserver/plane/api/views/__init__.py index c03d6d5b7..7e89c37f1 100644 --- a/apiserver/plane/api/views/__init__.py +++ b/apiserver/plane/api/views/__init__.py @@ -56,7 +56,7 @@ from .workspace import ( LeaveWorkspaceEndpoint, ) from .state import StateViewSet -from .view import GlobalViewViewSet, GlobalViewIssuesViewSet, IssueViewViewSet, ViewIssuesEndpoint, IssueViewFavoriteViewSet +from .view import GlobalViewViewSet, GlobalViewIssuesViewSet, IssueViewViewSet, IssueViewFavoriteViewSet from .cycle import ( CycleViewSet, CycleIssueViewSet, diff --git a/apiserver/plane/api/views/view.py b/apiserver/plane/api/views/view.py index b6f1d7c4b..bf47d1e4b 100644 --- a/apiserver/plane/api/views/view.py +++ b/apiserver/plane/api/views/view.py @@ -243,51 +243,6 @@ class IssueViewViewSet(BaseViewSet): ) -class ViewIssuesEndpoint(BaseAPIView): - permission_classes = [ - ProjectEntityPermission, - ] - - def get(self, request, slug, project_id, view_id): - try: - view = IssueView.objects.get(pk=view_id) - queries = view.query - - filters = issue_filters(request.query_params, "GET") - - issues = ( - Issue.issue_objects.filter( - **queries, project_id=project_id, workspace__slug=slug - ) - .filter(**filters) - .select_related("project") - .select_related("workspace") - .select_related("state") - .select_related("parent") - .prefetch_related("assignees") - .prefetch_related("labels") - .prefetch_related( - Prefetch( - "issue_reactions", - queryset=IssueReaction.objects.select_related("actor"), - ) - ) - ) - - serializer = IssueLiteSerializer(issues, many=True) - return Response(serializer.data, status=status.HTTP_200_OK) - except IssueView.DoesNotExist: - return Response( - {"error": "Issue View does not exist"}, status=status.HTTP_404_NOT_FOUND - ) - except Exception as e: - capture_exception(e) - return Response( - {"error": "Something went wrong please try again later"}, - status=status.HTTP_400_BAD_REQUEST, - ) - - class IssueViewFavoriteViewSet(BaseViewSet): serializer_class = IssueViewFavoriteSerializer model = IssueViewFavorite diff --git a/apiserver/plane/utils/issue_filters.py b/apiserver/plane/utils/issue_filters.py index 3a869113c..eec528916 100644 --- a/apiserver/plane/utils/issue_filters.py +++ b/apiserver/plane/utils/issue_filters.py @@ -1,7 +1,3 @@ -from django.utils.timezone import make_aware -from django.utils.dateparse import parse_datetime - - def filter_state(params, filter, method): if method == "GET": states = params.get("state").split(",")