diff --git a/apiserver/plane/api/serializers/workspace.py b/apiserver/plane/api/serializers/workspace.py index 4f4d13f76..4562726ae 100644 --- a/apiserver/plane/api/serializers/workspace.py +++ b/apiserver/plane/api/serializers/workspace.py @@ -44,6 +44,7 @@ class WorkSpaceMemberSerializer(BaseSerializer): class WorkSpaceMemberInviteSerializer(BaseSerializer): workspace = WorkSpaceSerializer(read_only=True) + total_members = serializers.IntegerField(read_only=True) class Meta: model = WorkspaceMemberInvite diff --git a/apiserver/plane/api/views/workspace.py b/apiserver/plane/api/views/workspace.py index 47dc1cd47..64154500f 100644 --- a/apiserver/plane/api/views/workspace.py +++ b/apiserver/plane/api/views/workspace.py @@ -375,6 +375,7 @@ class UserWorkspaceInvitationsEndpoint(BaseViewSet): .get_queryset() .filter(email=self.request.user.email) .select_related("workspace", "workspace__owner") + .annotate(total_members=Count("workspace__workspace_member")) ) def create(self, request):