From 8ff834c328f82ff81cdaebd8b0c4c9b78d93e414 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:23:04 +0530 Subject: [PATCH] chore: return total members, cycle and modules (#1637) --- apiserver/plane/api/views/project.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 2510c4ade..721212105 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -91,6 +91,24 @@ class ProjectViewSet(BaseViewSet): ) ) ) + .annotate( + total_members=ProjectMember.objects.filter(project_id=OuterRef("id")) + .order_by() + .annotate(count=Func(F("id"), function="Count")) + .values("count") + ) + .annotate( + total_cycles=Cycle.objects.filter(project_id=OuterRef("id")) + .order_by() + .annotate(count=Func(F("id"), function="Count")) + .values("count") + ) + .annotate( + total_modules=Module.objects.filter(project_id=OuterRef("id")) + .order_by() + .annotate(count=Func(F("id"), function="Count")) + .values("count") + ) .distinct() )