mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
revert: issues endpoint (#2555)
This commit is contained in:
parent
8cc61bc427
commit
7edaa49c21
@ -579,7 +579,6 @@ class CycleIssueViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
total_issues = issues.count()
|
|
||||||
issues_data = IssueStateSerializer(issues, many=True).data
|
issues_data = IssueStateSerializer(issues, many=True).data
|
||||||
|
|
||||||
if sub_group_by and sub_group_by == group_by:
|
if sub_group_by and sub_group_by == group_by:
|
||||||
@ -591,12 +590,12 @@ class CycleIssueViewSet(BaseViewSet):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues_data, group_by, sub_group_by)
|
grouped_results = group_results(issues_data, group_by, sub_group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{"data": issues_data, "total_issues": total_issues}, status=status.HTTP_200_OK
|
issues_data, status=status.HTTP_200_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
def create(self, request, slug, project_id, cycle_id):
|
def create(self, request, slug, project_id, cycle_id):
|
||||||
|
@ -217,7 +217,6 @@ class IssueViewSet(BaseViewSet):
|
|||||||
else:
|
else:
|
||||||
issue_queryset = issue_queryset.order_by(order_by_param)
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
||||||
|
|
||||||
total_issues = issue_queryset.count()
|
|
||||||
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
||||||
|
|
||||||
## Grouping the results
|
## Grouping the results
|
||||||
@ -232,12 +231,12 @@ class IssueViewSet(BaseViewSet):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues, group_by, sub_group_by)
|
grouped_results = group_results(issues, group_by, sub_group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{"data": issues, "total_issues": total_issues}, status=status.HTTP_200_OK
|
issues, status=status.HTTP_200_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -426,7 +425,6 @@ class UserWorkSpaceIssues(BaseAPIView):
|
|||||||
else:
|
else:
|
||||||
issue_queryset = issue_queryset.order_by(order_by_param)
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
||||||
|
|
||||||
total_issues = issue_queryset.count()
|
|
||||||
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
||||||
|
|
||||||
## Grouping the results
|
## Grouping the results
|
||||||
@ -441,12 +439,12 @@ class UserWorkSpaceIssues(BaseAPIView):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues, group_by, sub_group_by)
|
grouped_results = group_results(issues, group_by, sub_group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{"data": issues, "total_issues": total_issues}, status=status.HTTP_200_OK
|
issues, status=status.HTTP_200_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -2151,7 +2149,6 @@ class IssueDraftViewSet(BaseViewSet):
|
|||||||
else:
|
else:
|
||||||
issue_queryset = issue_queryset.order_by(order_by_param)
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
||||||
|
|
||||||
total_issues = issue_queryset.count()
|
|
||||||
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
||||||
|
|
||||||
## Grouping the results
|
## Grouping the results
|
||||||
@ -2159,12 +2156,12 @@ class IssueDraftViewSet(BaseViewSet):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues, group_by)
|
grouped_results = group_results(issues, group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{"data": issues, "total_issues": total_issues}, status=status.HTTP_200_OK
|
issues, status=status.HTTP_200_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
def create(self, request, slug, project_id):
|
def create(self, request, slug, project_id):
|
||||||
|
@ -364,7 +364,6 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||||||
.values("count")
|
.values("count")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
total_issues = issues.count()
|
|
||||||
issues_data = IssueStateSerializer(issues, many=True).data
|
issues_data = IssueStateSerializer(issues, many=True).data
|
||||||
|
|
||||||
if sub_group_by and sub_group_by == group_by:
|
if sub_group_by and sub_group_by == group_by:
|
||||||
@ -376,12 +375,12 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues_data, group_by, sub_group_by)
|
grouped_results = group_results(issues_data, group_by, sub_group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{"data": issues_data, "total_issues": total_issues}, status=status.HTTP_200_OK
|
issues_data, status=status.HTTP_200_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
def create(self, request, slug, project_id, module_id):
|
def create(self, request, slug, project_id, module_id):
|
||||||
|
@ -93,7 +93,6 @@ class GlobalViewIssuesViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(gzip_page)
|
@method_decorator(gzip_page)
|
||||||
def list(self, request, slug):
|
def list(self, request, slug):
|
||||||
filters = issue_filters(request.query_params, "GET")
|
filters = issue_filters(request.query_params, "GET")
|
||||||
@ -117,9 +116,7 @@ class GlobalViewIssuesViewSet(BaseViewSet):
|
|||||||
.values("count")
|
.values("count")
|
||||||
)
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
attachment_count=IssueAttachment.objects.filter(
|
attachment_count=IssueAttachment.objects.filter(issue=OuterRef("id"))
|
||||||
issue=OuterRef("id")
|
|
||||||
)
|
|
||||||
.order_by()
|
.order_by()
|
||||||
.annotate(count=Func(F("id"), function="Count"))
|
.annotate(count=Func(F("id"), function="Count"))
|
||||||
.values("count")
|
.values("count")
|
||||||
@ -129,9 +126,7 @@ class GlobalViewIssuesViewSet(BaseViewSet):
|
|||||||
# Priority Ordering
|
# Priority Ordering
|
||||||
if order_by_param == "priority" or order_by_param == "-priority":
|
if order_by_param == "priority" or order_by_param == "-priority":
|
||||||
priority_order = (
|
priority_order = (
|
||||||
priority_order
|
priority_order if order_by_param == "priority" else priority_order[::-1]
|
||||||
if order_by_param == "priority"
|
|
||||||
else priority_order[::-1]
|
|
||||||
)
|
)
|
||||||
issue_queryset = issue_queryset.annotate(
|
issue_queryset = issue_queryset.annotate(
|
||||||
priority_order=Case(
|
priority_order=Case(
|
||||||
@ -183,8 +178,6 @@ class GlobalViewIssuesViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
issue_queryset = issue_queryset.order_by(order_by_param)
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
||||||
|
|
||||||
total_issues = issue_queryset.count()
|
|
||||||
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
||||||
|
|
||||||
## Grouping the results
|
## Grouping the results
|
||||||
@ -199,13 +192,11 @@ class GlobalViewIssuesViewSet(BaseViewSet):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues, group_by, sub_group_by)
|
grouped_results = group_results(issues, group_by, sub_group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(issues, status=status.HTTP_200_OK)
|
||||||
{"data": issues, "total_issues": total_issues}, status=status.HTTP_200_OK
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IssueViewViewSet(BaseViewSet):
|
class IssueViewViewSet(BaseViewSet):
|
||||||
|
@ -1223,7 +1223,6 @@ class WorkspaceUserProfileIssuesEndpoint(BaseAPIView):
|
|||||||
else:
|
else:
|
||||||
issue_queryset = issue_queryset.order_by(order_by_param)
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
||||||
|
|
||||||
total_issues = issue_queryset.count()
|
|
||||||
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
||||||
|
|
||||||
## Grouping the results
|
## Grouping the results
|
||||||
@ -1231,12 +1230,12 @@ class WorkspaceUserProfileIssuesEndpoint(BaseAPIView):
|
|||||||
if group_by:
|
if group_by:
|
||||||
grouped_results = group_results(issues, group_by)
|
grouped_results = group_results(issues, group_by)
|
||||||
return Response(
|
return Response(
|
||||||
{"data": grouped_results, "total_issues": total_issues},
|
grouped_results,
|
||||||
status=status.HTTP_200_OK,
|
status=status.HTTP_200_OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{"data": issues, "total_issues": total_issues}, status=status.HTTP_200_OK
|
issues, status=status.HTTP_200_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user