chore: return total members, cycle and modules (#1637)

This commit is contained in:
Nikhil 2023-07-24 12:23:04 +05:30 committed by GitHub
parent 4ee161bae2
commit 8ff834c328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() .distinct()
) )