Merge branch 'feat/pagination' of github.com:makeplane/plane into feat/pagination

This commit is contained in:
rahulramesha 2024-03-22 18:17:47 +05:30
commit e3b5b5d65b
8 changed files with 82 additions and 18 deletions

View File

@ -819,7 +819,11 @@ class CycleIssueViewSet(WebhookMixin, BaseViewSet):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -855,7 +859,11 @@ class CycleIssueViewSet(WebhookMixin, BaseViewSet):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -142,7 +142,11 @@ class IssueArchiveViewSet(BaseViewSet):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -178,7 +182,11 @@ class IssueArchiveViewSet(BaseViewSet):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -142,7 +142,11 @@ class IssueListEndpoint(BaseAPIView):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -178,7 +182,11 @@ class IssueListEndpoint(BaseAPIView):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -308,7 +316,11 @@ class IssueViewSet(WebhookMixin, BaseViewSet):
else:
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -343,7 +355,11 @@ class IssueViewSet(WebhookMixin, BaseViewSet):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -129,7 +129,11 @@ class IssueDraftViewSet(BaseViewSet):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -165,7 +169,11 @@ class IssueDraftViewSet(BaseViewSet):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -543,7 +543,11 @@ class ModuleIssueViewSet(WebhookMixin, BaseViewSet):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -579,7 +583,11 @@ class ModuleIssueViewSet(WebhookMixin, BaseViewSet):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -188,7 +188,11 @@ class GlobalViewIssuesViewSet(BaseViewSet):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -224,7 +228,11 @@ class GlobalViewIssuesViewSet(BaseViewSet):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -592,7 +592,11 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
# group and sub group pagination
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,
@ -628,7 +632,11 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
# Group paginate
return self.paginate(
request=request,
order_by=order_by_param,
order_by=(
"priority_order"
if order_by_param in ["priority", "-priority"]
else order_by_param
),
queryset=issue_queryset,
on_results=lambda issues: issue_on_results(
group_by=group_by,

View File

@ -26,8 +26,8 @@ def issue_queryset_grouper(queryset, group_by, sub_group_by):
}
annotations_map = {
"label_ids": ("assignees__id", ~Q(assignees__id__isnull=True)),
"assignee_ids": ("labels__id", ~Q(labels__id__isnull=True)),
"assignee_ids": ("assignees__id", ~Q(assignees__id__isnull=True)),
"label_ids": ("labels__id", ~Q(labels__id__isnull=True)),
"module_ids": (
"issue_module__module_id",
~Q(issue_module__module_id__isnull=True),