feat: project member role (#1828)

This commit is contained in:
Nikhil 2023-08-11 12:46:29 +05:30 committed by GitHub
parent 0a1483c482
commit be86a7d38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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()
)