From c9dee593ebcdd7e6b884e6c5a3b5fa5852660dce Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Sun, 28 May 2023 18:11:59 +0530 Subject: [PATCH] chore: total members in user workspace invites (#1143) --- apiserver/plane/api/serializers/workspace.py | 1 + apiserver/plane/api/views/workspace.py | 1 + 2 files changed, 2 insertions(+) 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):