From e46487c1302f3af47b43a47eb4a9f62ef1223d8a Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 6 Apr 2023 22:57:06 +0530 Subject: [PATCH] chore: add project details on importer service endpoint (#714) * chore: add project details on importer service endpoint * dev: add select related for imports --- apiserver/plane/api/serializers/importer.py | 2 ++ apiserver/plane/api/views/importer.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apiserver/plane/api/serializers/importer.py b/apiserver/plane/api/serializers/importer.py index 28f2153c8..fcc7da6ce 100644 --- a/apiserver/plane/api/serializers/importer.py +++ b/apiserver/plane/api/serializers/importer.py @@ -1,11 +1,13 @@ # Module imports from .base import BaseSerializer from .user import UserLiteSerializer +from .project import ProjectLiteSerializer from plane.db.models import Importer class ImporterSerializer(BaseSerializer): initiated_by_detail = UserLiteSerializer(source="initiated_by", read_only=True) + project_detail = ProjectLiteSerializer(source="project", read_only=True) class Meta: model = Importer diff --git a/apiserver/plane/api/views/importer.py b/apiserver/plane/api/views/importer.py index dd52d2dd2..15ff20f55 100644 --- a/apiserver/plane/api/views/importer.py +++ b/apiserver/plane/api/views/importer.py @@ -213,8 +213,10 @@ class ImportServiceEndpoint(BaseAPIView): def get(self, request, slug): try: - imports = Importer.objects.filter(workspace__slug=slug).order_by( - "-created_at" + imports = ( + Importer.objects.filter(workspace__slug=slug) + .order_by("-created_at") + .select_related("initiated_by", "project", "workspace") ) serializer = ImporterSerializer(imports, many=True) return Response(serializer.data)