mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: state response change
This commit is contained in:
parent
7e95b8f160
commit
4761d4e0e9
@ -83,6 +83,7 @@ from plane.utils.grouper import group_results
|
|||||||
from plane.utils.issue_filters import issue_filters
|
from plane.utils.issue_filters import issue_filters
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
class IssueViewSet(WebhookMixin, BaseViewSet):
|
class IssueViewSet(WebhookMixin, BaseViewSet):
|
||||||
def get_serializer_class(self):
|
def get_serializer_class(self):
|
||||||
return (
|
return (
|
||||||
@ -711,10 +712,15 @@ class LabelViewSet(BaseViewSet):
|
|||||||
|
|
||||||
def list(self, request, slug, project_id):
|
def list(self, request, slug, project_id):
|
||||||
labels = Label.objects.filter(
|
labels = Label.objects.filter(
|
||||||
workspace__slug=slug,
|
workspace__slug=slug, project_id=project_id
|
||||||
project_id=project_id
|
|
||||||
).values(
|
).values(
|
||||||
"parent", "name", "color", "id", "project_id", "workspace__slug"
|
"parent",
|
||||||
|
"name",
|
||||||
|
"color",
|
||||||
|
"id",
|
||||||
|
"project_id",
|
||||||
|
"workspace__slug",
|
||||||
|
"sort_order",
|
||||||
)
|
)
|
||||||
return Response(labels, status=status.HTTP_200_OK)
|
return Response(labels, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
@ -830,7 +836,9 @@ class SubIssuesEndpoint(BaseAPIView):
|
|||||||
|
|
||||||
_ = Issue.objects.bulk_update(sub_issues, ["parent"], batch_size=10)
|
_ = Issue.objects.bulk_update(sub_issues, ["parent"], batch_size=10)
|
||||||
|
|
||||||
updated_sub_issues = Issue.issue_objects.filter(id__in=sub_issue_ids).annotate(state_group=F("state__group"))
|
updated_sub_issues = Issue.issue_objects.filter(
|
||||||
|
id__in=sub_issue_ids
|
||||||
|
).annotate(state_group=F("state__group"))
|
||||||
|
|
||||||
# Track the issue
|
# Track the issue
|
||||||
_ = [
|
_ = [
|
||||||
@ -864,7 +872,6 @@ class SubIssuesEndpoint(BaseAPIView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class IssueLinkViewSet(BaseViewSet):
|
class IssueLinkViewSet(BaseViewSet):
|
||||||
permission_classes = [
|
permission_classes = [
|
||||||
ProjectEntityPermission,
|
ProjectEntityPermission,
|
||||||
|
@ -49,7 +49,9 @@ class StateViewSet(BaseViewSet):
|
|||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
def list(self, request, slug, project_id):
|
def list(self, request, slug, project_id):
|
||||||
states = StateSerializer(self.get_queryset(), many=True).data
|
states = State.objects.filter(workspace__slug=slug, project_id=project_id).values(
|
||||||
|
"id", "project_id", "workspace__slug", "name", "color", "group"
|
||||||
|
)
|
||||||
grouped = request.GET.get("grouped", False)
|
grouped = request.GET.get("grouped", False)
|
||||||
if grouped == "true":
|
if grouped == "true":
|
||||||
state_dict = {}
|
state_dict = {}
|
||||||
|
@ -1362,7 +1362,9 @@ class WorkspaceUserProfileIssuesEndpoint(BaseAPIView):
|
|||||||
.values("count")
|
.values("count")
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
sub_issues_count=Issue.issue_objects.filter(
|
||||||
|
parent=OuterRef("id")
|
||||||
|
)
|
||||||
.order_by()
|
.order_by()
|
||||||
.annotate(count=Func(F("id"), function="Count"))
|
.annotate(count=Func(F("id"), function="Count"))
|
||||||
.values("count")
|
.values("count")
|
||||||
@ -1446,7 +1448,13 @@ class WorkspaceLabelsEndpoint(BaseAPIView):
|
|||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
project__project_projectmember__member=request.user,
|
project__project_projectmember__member=request.user,
|
||||||
).values(
|
).values(
|
||||||
"parent", "name", "color", "id", "project_id", "workspace__slug"
|
"parent",
|
||||||
|
"name",
|
||||||
|
"color",
|
||||||
|
"id",
|
||||||
|
"project_id",
|
||||||
|
"workspace__slug",
|
||||||
|
"sort_order",
|
||||||
)
|
)
|
||||||
return Response(labels, status=status.HTTP_200_OK)
|
return Response(labels, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user