on /get-hierarchy: raise exception if users institution id is missing
This commit is contained in:
@@ -55,6 +55,7 @@ async def get_org_by_name(
|
||||
response_model=HierarchyResponse | None,
|
||||
summary="Returns the hierarchy of organizations.",
|
||||
tags=[Tags.ORGMINER],
|
||||
responses={400: {"description": "Account does not have an associated organization with a valid OpenAlex institution ID."}},
|
||||
)
|
||||
async def get_hierarchy(
|
||||
session:SessionDep,
|
||||
@@ -66,8 +67,10 @@ async def get_hierarchy(
|
||||
"""
|
||||
institution_id = _get_account_institution_id(session, access_token_metadata.effective_account_id)
|
||||
if not institution_id:
|
||||
return None
|
||||
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="Account does not have an associated organization with a valid OpenAlex institution ID.",
|
||||
)
|
||||
can_edit = UserRole.MANAGER in _get_account_roles(session, access_token_metadata.effective_account_id)
|
||||
number_of_suggestion_slots = logic.get_number_of_suggestion_slots_today(session, access_token_metadata.effective_account_id)
|
||||
hierarchy = await logic.get_hierarchy(institution_id)
|
||||
|
||||
Reference in New Issue
Block a user