dev: update workspace apis

This commit is contained in:
pablohashescobar 2024-02-15 13:10:57 +05:30
parent 326d59d769
commit d3e7c45e1e
2 changed files with 2 additions and 13 deletions

View File

@ -18,7 +18,7 @@ from plane.db.models import (
class WorkSpaceSerializer(DynamicBaseSerializer): class WorkSpaceSerializer(DynamicBaseSerializer):
owner = UserLiteSerializer(read_only=True) owner_id = serializers.PrimaryKeyRelatedField(read_only=True)
total_members = serializers.IntegerField(read_only=True) total_members = serializers.IntegerField(read_only=True)
total_issues = serializers.IntegerField(read_only=True) total_issues = serializers.IntegerField(read_only=True)
@ -48,7 +48,7 @@ class WorkSpaceSerializer(DynamicBaseSerializer):
"updated_by", "updated_by",
"created_at", "created_at",
"updated_at", "updated_at",
"owner", "owner_id",
] ]

View File

@ -69,7 +69,6 @@ from plane.db.models import (
Label, Label,
WorkspaceMember, WorkspaceMember,
CycleIssue, CycleIssue,
IssueReaction,
WorkspaceUserProperties, WorkspaceUserProperties,
Estimate, Estimate,
EstimatePoint, EstimatePoint,
@ -80,7 +79,6 @@ from plane.app.permissions import (
WorkspaceEntityPermission, WorkspaceEntityPermission,
WorkspaceViewerPermission, WorkspaceViewerPermission,
WorkspaceUserPermission, WorkspaceUserPermission,
ProjectLitePermission,
) )
from plane.bgtasks.workspace_invitation_task import workspace_invitation from plane.bgtasks.workspace_invitation_task import workspace_invitation
from plane.utils.issue_filters import issue_filters from plane.utils.issue_filters import issue_filters
@ -114,13 +112,6 @@ class WorkSpaceViewSet(BaseViewSet):
.annotate(count=Func(F("id"), function="Count")) .annotate(count=Func(F("id"), function="Count"))
.values("count") .values("count")
) )
issue_count = (
Issue.issue_objects.filter(workspace=OuterRef("id"))
.order_by()
.annotate(count=Func(F("id"), function="Count"))
.values("count")
)
return ( return (
self.filter_queryset( self.filter_queryset(
super().get_queryset().select_related("owner") super().get_queryset().select_related("owner")
@ -131,8 +122,6 @@ class WorkSpaceViewSet(BaseViewSet):
workspace_member__is_active=True, workspace_member__is_active=True,
) )
.annotate(total_members=member_count) .annotate(total_members=member_count)
.annotate(total_issues=issue_count)
.select_related("owner")
) )
def create(self, request): def create(self, request):