def read_search(search_id: int, search_repository: repository.search_repository.SearchRepository = fastapi.Depends(), user: auth.authentication.User = fastapi.Depends(auth.authentication.get_current_user)): """ Get the details for a previously submitted search request Parameters: search_id: The identifier of the search instance to lookup Returns: schemas.search.Search """ search_db_row = search_repository.get_search(search_id) if search_db_row is None: raise fastapi.HTTPException(status_code=404, detail='Search record not found') return search_db_row
def read_search_results(search_id: int, search_repository: repository.search_repository.SearchRepository = fastapi.Depends(), user: auth.authentication.User = fastapi.Depends(auth.authentication.get_current_user)): """ List the results for the provided search Parameters: search_id: The identifier of the search instance to lookup Returns: typing.List[schemas.search.SearchResult] """ search_db_row = search_repository.get_search(search_id) if search_db_row is None: raise fastapi.HTTPException(status_code=404, detail='Search record not found') return list(map(map_search_result_output, search_db_row.results))