chore: deploy board status for project (#1866)

This commit is contained in:
Nikhil 2023-08-16 01:00:22 +05:30 committed by GitHub
parent 07717e9a93
commit b554087b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -103,6 +103,7 @@ class ProjectDetailSerializer(BaseSerializer):
is_member = serializers.BooleanField(read_only=True) is_member = serializers.BooleanField(read_only=True)
sort_order = serializers.FloatField(read_only=True) sort_order = serializers.FloatField(read_only=True)
member_role = serializers.IntegerField(read_only=True) member_role = serializers.IntegerField(read_only=True)
is_deployed = serializers.BooleanField(read_only=True)
class Meta: class Meta:
model = Project model = Project

View File

@ -145,6 +145,14 @@ class ProjectViewSet(BaseViewSet):
member_id=self.request.user.id, member_id=self.request.user.id,
).values("role") ).values("role")
) )
.annotate(
is_deployed=Exists(
ProjectDeployBoard.objects.filter(
project_id=OuterRef("pk"),
workspace__slug=self.kwargs.get("slug"),
)
)
)
.distinct() .distinct()
) )
@ -216,7 +224,9 @@ class ProjectViewSet(BaseViewSet):
project_id=serializer.data["id"], member=request.user, role=20 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( ProjectMember.objects.create(
project_id=serializer.data["id"], project_id=serializer.data["id"],
member_id=serializer.data["project_lead"], member_id=serializer.data["project_lead"],