File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 77
88from api .models import Organization
99from api .types .base_type import BaseType
10+ from authorization .types import TypeOrganizationMembership
1011
1112
1213@strawberry_django .filter (Organization )
@@ -119,3 +120,18 @@ def members_count(self, info: Info) -> int:
119120 return OrganizationMembership .objects .filter (organization_id = org_id ).count () # type: ignore
120121 except Exception :
121122 return 0
123+
124+ @strawberry .field (description = "Members in this organization" )
125+ def members (self , info : Info ) -> List [TypeOrganizationMembership ]:
126+ """Get members in this organization."""
127+ try :
128+ from authorization .models import OrganizationMembership
129+
130+ org_id = getattr (self , "id" , None )
131+ if not org_id :
132+ return []
133+
134+ queryset = OrganizationMembership .objects .filter (organization_id = org_id )
135+ return TypeOrganizationMembership .from_django_list (queryset )
136+ except Exception :
137+ return []
You can’t perform that action at this time.
0 commit comments