chore: total members in user workspace invites (#1143)

This commit is contained in:
pablohashescobar 2023-05-28 18:11:59 +05:30 committed by GitHub
parent bc8430220b
commit c9dee593eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -44,6 +44,7 @@ class WorkSpaceMemberSerializer(BaseSerializer):
class WorkSpaceMemberInviteSerializer(BaseSerializer): class WorkSpaceMemberInviteSerializer(BaseSerializer):
workspace = WorkSpaceSerializer(read_only=True) workspace = WorkSpaceSerializer(read_only=True)
total_members = serializers.IntegerField(read_only=True)
class Meta: class Meta:
model = WorkspaceMemberInvite model = WorkspaceMemberInvite

View File

@ -375,6 +375,7 @@ class UserWorkspaceInvitationsEndpoint(BaseViewSet):
.get_queryset() .get_queryset()
.filter(email=self.request.user.email) .filter(email=self.request.user.email)
.select_related("workspace", "workspace__owner") .select_related("workspace", "workspace__owner")
.annotate(total_members=Count("workspace__workspace_member"))
) )
def create(self, request): def create(self, request):