remove: state delete issue validation endpoint (#929)

This commit is contained in:
pablohashescobar 2023-04-22 18:18:08 +05:30 committed by GitHub
parent 0be6738715
commit 48e77ea81b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 26 deletions

View File

@ -79,7 +79,6 @@ from plane.api.views import (
## End Issues ## End Issues
# States # States
StateViewSet, StateViewSet,
StateDeleteIssueCheckEndpoint,
## End States ## End States
# Estimates # Estimates
ProjectEstimatePointEndpoint, ProjectEstimatePointEndpoint,
@ -509,11 +508,6 @@ urlpatterns = [
), ),
name="project-state", name="project-state",
), ),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/states/<uuid:pk>/",
StateDeleteIssueCheckEndpoint.as_view(),
name="state-delete-check",
),
# End States ## # End States ##
# Estimates # Estimates
path( path(

View File

@ -42,7 +42,7 @@ from .workspace import (
UserWorkspaceDashboardEndpoint, UserWorkspaceDashboardEndpoint,
WorkspaceThemeViewSet, WorkspaceThemeViewSet,
) )
from .state import StateViewSet, StateDeleteIssueCheckEndpoint from .state import StateViewSet
from .shortcut import ShortCutViewSet from .shortcut import ShortCutViewSet
from .view import IssueViewViewSet, ViewIssuesEndpoint, IssueViewFavoriteViewSet from .view import IssueViewViewSet, ViewIssuesEndpoint, IssueViewFavoriteViewSet
from .cycle import ( from .cycle import (

View File

@ -103,22 +103,3 @@ class StateViewSet(BaseViewSet):
return Response(status=status.HTTP_204_NO_CONTENT) return Response(status=status.HTTP_204_NO_CONTENT)
except State.DoesNotExist: except State.DoesNotExist:
return Response({"error": "State does not exists"}, status=status.HTTP_404) return Response({"error": "State does not exists"}, status=status.HTTP_404)
class StateDeleteIssueCheckEndpoint(BaseAPIView):
permission_classes = [
ProjectEntityPermission,
]
def get(self, request, slug, project_id, pk):
try:
issue_count = Issue.objects.filter(
state=pk, workspace__slug=slug, project_id=project_id
).count()
return Response({"issue_count": issue_count}, status=status.HTTP_200_OK)
except Exception as e:
capture_exception(e)
return Response(
{"error": "Something went wrong please try again later"},
status=status.HTTP_400_BAD_REQUEST,
)