diff --git a/apiserver/plane/api/serializers/project.py b/apiserver/plane/api/serializers/project.py index 643518daa..9e30976ec 100644 --- a/apiserver/plane/api/serializers/project.py +++ b/apiserver/plane/api/serializers/project.py @@ -94,6 +94,7 @@ class ProjectDetailSerializer(BaseSerializer): total_modules = serializers.IntegerField(read_only=True) is_member = serializers.BooleanField(read_only=True) sort_order = serializers.FloatField(read_only=True) + member_role = serializers.IntegerField(read_only=True) class Meta: model = Project diff --git a/apiserver/plane/api/views/project.py b/apiserver/plane/api/views/project.py index 5911011b5..7387accd6 100644 --- a/apiserver/plane/api/views/project.py +++ b/apiserver/plane/api/views/project.py @@ -110,6 +110,12 @@ class ProjectViewSet(BaseViewSet): .annotate(count=Func(F("id"), function="Count")) .values("count") ) + .annotate( + member_role=ProjectMember.objects.filter( + project_id=OuterRef("pk"), + member_id=self.request.user.id, + ).values("role") + ) .distinct() )