chore: added user role for projects (#1190)

This commit is contained in:
Ramesh Kumar Chandra
2024-09-24 20:29:27 +05:30
committed by GitHub
parent 3d9341366f
commit dcf3f3b344

View File

@@ -44,6 +44,7 @@ class ProjectType:
total_members: int
total_issues: int
total_active_issues: int
role: int
@strawberry.field
def workspace(self) -> int:
@@ -73,6 +74,16 @@ class ProjectType:
).count()
)()
return projects
@strawberry.field
async def role(self, info: strawberry.Info) -> int:
project_member = await sync_to_async(
lambda: ProjectMember.objects.get(
project_id=self.id, is_active=True, member_id=info.context.user.id
)
)()
return project_member.role
@strawberry.field
async def total_issues(self, info: Info) -> int: