Skip to content

Commit

Permalink
get people finder API, endpoint and schema with wiring into core and …
Browse files Browse the repository at this point in the history
…profile services
  • Loading branch information
oyeniyipa committed Feb 24, 2025
1 parent b9a1b55 commit b951298
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
27 changes: 20 additions & 7 deletions core/schemas/peoplefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

from ninja import Schema


@dataclass
class User:
sso_email_id: str
from profiles.models import PeopleFinderProfile


@dataclass
Expand All @@ -21,16 +18,32 @@ class MinimalPeopleFinderProfile(Schema):
slug: str
first_name: str
last_name: str
user: Optional[User] # ForeignKey to "user.User"
sso_email_id: str
preferred_first_name: Optional[str]
pronouns: Optional[str]
name_pronunciation: Optional[str]
email: Optional[Email] # ForeignKey to "profiles.Email"
contact_email: Optional[Email] # ForeignKey to "profiles.Email"
email: Optional[str]
contact_email: Optional[str]
primary_phone_number: Optional[str]
secondary_phone_number: Optional[str]
photo: Optional[str] # ImageField is represented as a string (file path or URL)
photo_small: Optional[
str
] # ImageField is represented as a string (file path or URL)
grade: Optional[str]

@staticmethod
def resolve_slug(obj: PeopleFinderProfile):
return str(obj.slug)

@staticmethod
def resolve_sso_email_id(obj: PeopleFinderProfile):
return obj.user.sso_email_id

@staticmethod
def resolve_email(obj: PeopleFinderProfile):
return obj.email.address

@staticmethod
def resolve_contact_email(obj: PeopleFinderProfile):
return obj.contact_email.address
6 changes: 5 additions & 1 deletion profiles/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib import admin

from profiles.models import PeopleFinderProfile
from profiles.models.combined import Profile
from profiles.models.generic import Email
from profiles.models.generic import Country, Email, UkStaffLocation
from profiles.models.staff_sso import StaffSSOProfile, StaffSSOProfileEmail


Expand All @@ -10,3 +11,6 @@
admin.site.register(StaffSSOProfile)
admin.site.register(StaffSSOProfileEmail)
admin.site.register(Profile)
admin.site.register(UkStaffLocation)
admin.site.register(Country)
admin.site.register(PeopleFinderProfile)

0 comments on commit b951298

Please sign in to comment.