From 3325a28921b04a438d9fc7c7bbad1496b317b417 Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Thu, 22 Dec 2022 15:53:29 +0530 Subject: [PATCH] fix: issue serializer --- apiserver/plane/api/serializers/issue.py | 2 +- apiserver/plane/api/views/issue.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/api/serializers/issue.py b/apiserver/plane/api/serializers/issue.py index d287cc18f..37e157a3b 100644 --- a/apiserver/plane/api/serializers/issue.py +++ b/apiserver/plane/api/serializers/issue.py @@ -384,7 +384,7 @@ class IssueSerializer(BaseSerializer): blocked_issues = BlockedIssueSerializer(read_only=True, many=True) blocker_issues = BlockerIssueSerializer(read_only=True, many=True) issue_cycle = IssueCycleDetailSerializer(read_only=True) - issue_module = IssueModuleDetailSerializer(read_only=True) + issue_module = IssueModuleDetailSerializer(read_only=True, many=True) class Meta: model = Issue diff --git a/apiserver/plane/api/views/issue.py b/apiserver/plane/api/views/issue.py index 9b13dae4c..9dcbb2724 100644 --- a/apiserver/plane/api/views/issue.py +++ b/apiserver/plane/api/views/issue.py @@ -37,6 +37,7 @@ from plane.db.models import ( Label, IssueBlocker, CycleIssue, + ModuleIssue ) @@ -96,6 +97,12 @@ class IssueViewSet(BaseViewSet): queryset=CycleIssue.objects.select_related("cycle", "issue"), ), ) + .prefetch_related( + Prefetch( + "issue_module", + queryset=ModuleIssue.objects.select_related("module", "issue"), + ), + ) ) def grouper(self, issue, group_by): @@ -175,6 +182,7 @@ class UserWorkSpaceIssues(BaseAPIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR, ) + class WorkSpaceIssuesEndpoint(BaseAPIView): permission_classes = [