From b554087b1fe5d069c2318a4c8c7493acc098f7f8 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Wed, 16 Aug 2023 01:00:22 +0530 Subject: [PATCH] chore: deploy board status for project (#1866) --- apiserver/plane/api/serializers/project.py | 1 + apiserver/plane/api/views/project.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/api/serializers/project.py b/apiserver/plane/api/serializers/project.py index af60be89c..18983c7be 100644 --- a/apiserver/plane/api/serializers/project.py +++ b/apiserver/plane/api/serializers/project.py @@ -103,6 +103,7 @@ class ProjectDetailSerializer(BaseSerializer): is_member = serializers.BooleanField(read_only=True) sort_order = serializers.FloatField(read_only=True) member_role = serializers.IntegerField(read_only=True) + is_deployed = serializers.BooleanField(read_only=True) class Meta: model = Project diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 6d570865d..6f15069ed 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -145,6 +145,14 @@ class ProjectViewSet(BaseViewSet): member_id=self.request.user.id, ).values("role") ) + .annotate( + is_deployed=Exists( + ProjectDeployBoard.objects.filter( + project_id=OuterRef("pk"), + workspace__slug=self.kwargs.get("slug"), + ) + ) + ) .distinct() ) @@ -216,7 +224,9 @@ class ProjectViewSet(BaseViewSet): project_id=serializer.data["id"], member=request.user, role=20 ) - if serializer.data["project_lead"] is not None and str(serializer.data["project_lead"]) != str(request.user.id): + if serializer.data["project_lead"] is not None and str( + serializer.data["project_lead"] + ) != str(request.user.id): ProjectMember.objects.create( project_id=serializer.data["id"], member_id=serializer.data["project_lead"],