Skip to content

Commit

Permalink
Public faaculty page
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Dec 2, 2024
1 parent 60dbfa9 commit 083c29c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/institution/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class Query(object):
current_institution = graphene.Field(InstitutionType)
institutions = graphene.List(InstitutionType)
public_institutions = graphene.List(InstitutionType)
public_faculty = graphene.Field(FacultyType, id=graphene.String())
faculties = graphene.List(FacultyType)
issuers = graphene.List(IssuerType)
faculty = graphene.Field(FacultyType, id=graphene.String())
Expand All @@ -140,6 +141,11 @@ def resolve_public_institution(self, info, **kwargs):
def resolve_public_institutions(self, info, **kwargs):
return Institution.objects.filter(public_institution=True).all()

def resolve_public_faculty(self, info, **kwargs):
id = kwargs.get('id')
if id is not None:
return Faculty.objects.get(entity_id=id)

def resolve_faculties(self, info, **kwargs):
return [fac for fac in Faculty.objects.all() if fac.has_permissions(info.context.user, ['may_read'])]

Expand Down
1 change: 1 addition & 0 deletions apps/issuer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def get_json(self, obi_version=CURRENT_OBI_VERSION, include_extra=True, use_cano
'on_behalf_of': self.faculty.on_behalf_of,
'on_behalf_of_url': self.faculty.on_behalf_of_url,
'on_behalf_of_display_name': self.faculty.on_behalf_of_display_name,
'entityId': self.faculty.entity_id,
'institution': self.faculty.institution.get_json(obi_version=CURRENT_OBI_VERSION,
expand_awards=expand_awards)}
image_url = OriginSetting.HTTP + reverse('faculty_image', kwargs={'entity_id': self.faculty.entity_id})
Expand Down

0 comments on commit 083c29c

Please sign in to comment.