Merge branch 'refactor/publish-project' of https://github.com/makeplane/plane into refactor/publish-project

This commit is contained in:
Aaryan Khandelwal 2024-06-06 17:28:06 +05:30
commit 3ca3561c89
2 changed files with 7 additions and 8 deletions

View File

@ -114,7 +114,7 @@ class ProjectListSerializer(DynamicBaseSerializer):
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) anchor = serializers.CharField(read_only=True)
members = serializers.SerializerMethodField() members = serializers.SerializerMethodField()
def get_members(self, obj): def get_members(self, obj):
@ -148,7 +148,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) anchor = serializers.CharField(read_only=True)
class Meta: class Meta:
model = Project model = Project

View File

@ -137,12 +137,11 @@ class ProjectViewSet(BaseViewSet):
).values("role") ).values("role")
) )
.annotate( .annotate(
is_deployed=Exists( anchor=DeployBoard.objects.filter(
DeployBoard.objects.filter( entity_name="project",
project_id=OuterRef("pk"), entity_identifier=OuterRef("pk"),
workspace__slug=self.kwargs.get("slug"), workspace__slug=self.kwargs.get("slug"),
) ).values("anchor")
)
) )
.annotate(sort_order=Subquery(sort_order)) .annotate(sort_order=Subquery(sort_order))
.prefetch_related( .prefetch_related(