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 21, 2025
1 parent efb5c10 commit 93dcf06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/api/people_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
)
def get_by_slug(request, slug: str):
"""Just a demo, do not build against this"""
"""Optimised, low-flexibility endpoint to return a minimal peoplefinder profile record"""
try:
return core_services.get_peoplefinder_profile_by_slug(slug=slug)
except PeopleFinderProfile.DoesNotExist:
Expand Down
6 changes: 5 additions & 1 deletion core/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Optional

from profiles import services as profile_services
from profiles.models import PeopleFinderProfile
from profiles.models.combined import Profile
from profiles.types import UNSET, Unset # noqa
from user import services as user_services
Expand Down Expand Up @@ -183,5 +184,8 @@ def delete_identity(profile: Profile) -> None:
user_services.delete_from_database(user=user)


def get_peoplefinder_profile_by_slug(slug: str):
def get_peoplefinder_profile_by_slug(slug: str) -> PeopleFinderProfile:
"""
Retrieve peoplefinder profile by its slug.
"""
return profile_services.get_peoplefinder_profile_by_slug(slug=slug)
6 changes: 5 additions & 1 deletion profiles/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,9 @@ def delete(profile_id: str) -> dict[str, models.Model]:
return all_profiles


def get_peoplefinder_profile_by_slug(slug):
def get_peoplefinder_profile_by_slug(slug: str) -> PeopleFinderProfile:
"""
Gets peoplefinder profile from peoplefinder service
:param slug: Peoplefinder profile slug
"""
return peoplefinder.get_by_slug(slug=slug)

0 comments on commit 93dcf06

Please sign in to comment.