mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: remove auto filter endpoint
This commit is contained in:
parent
de7a672b79
commit
d47efaa0f0
@ -105,7 +105,6 @@ from plane.api.views import (
|
|||||||
GlobalViewViewSet,
|
GlobalViewViewSet,
|
||||||
GlobalViewIssuesViewSet,
|
GlobalViewIssuesViewSet,
|
||||||
IssueViewViewSet,
|
IssueViewViewSet,
|
||||||
ViewIssuesEndpoint,
|
|
||||||
IssueViewFavoriteViewSet,
|
IssueViewFavoriteViewSet,
|
||||||
## End Views
|
## End Views
|
||||||
# Cycles
|
# Cycles
|
||||||
@ -649,11 +648,6 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
name="project-view",
|
name="project-view",
|
||||||
),
|
),
|
||||||
path(
|
|
||||||
"workspaces/<str:slug>/projects/<uuid:project_id>/views/<uuid:view_id>/issues/",
|
|
||||||
ViewIssuesEndpoint.as_view(),
|
|
||||||
name="project-view-issues",
|
|
||||||
),
|
|
||||||
path(
|
path(
|
||||||
"workspaces/<str:slug>/views/",
|
"workspaces/<str:slug>/views/",
|
||||||
GlobalViewViewSet.as_view(
|
GlobalViewViewSet.as_view(
|
||||||
|
@ -56,7 +56,7 @@ from .workspace import (
|
|||||||
LeaveWorkspaceEndpoint,
|
LeaveWorkspaceEndpoint,
|
||||||
)
|
)
|
||||||
from .state import StateViewSet
|
from .state import StateViewSet
|
||||||
from .view import GlobalViewViewSet, GlobalViewIssuesViewSet, IssueViewViewSet, ViewIssuesEndpoint, IssueViewFavoriteViewSet
|
from .view import GlobalViewViewSet, GlobalViewIssuesViewSet, IssueViewViewSet, IssueViewFavoriteViewSet
|
||||||
from .cycle import (
|
from .cycle import (
|
||||||
CycleViewSet,
|
CycleViewSet,
|
||||||
CycleIssueViewSet,
|
CycleIssueViewSet,
|
||||||
|
@ -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):
|
class IssueViewFavoriteViewSet(BaseViewSet):
|
||||||
serializer_class = IssueViewFavoriteSerializer
|
serializer_class = IssueViewFavoriteSerializer
|
||||||
model = IssueViewFavorite
|
model = IssueViewFavorite
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
from django.utils.timezone import make_aware
|
|
||||||
from django.utils.dateparse import parse_datetime
|
|
||||||
|
|
||||||
|
|
||||||
def filter_state(params, filter, method):
|
def filter_state(params, filter, method):
|
||||||
if method == "GET":
|
if method == "GET":
|
||||||
states = params.get("state").split(",")
|
states = params.get("state").split(",")
|
||||||
|
Loading…
Reference in New Issue
Block a user