fix(works_v2): fixed endpoint typo
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from typing import Annotated, List, Optional
|
||||
|
||||
from fastapi import APIRouter, Path, Query
|
||||
@@ -17,6 +18,8 @@ from inse.models.openalex.topic import Topic
|
||||
|
||||
WORKS_v2_PREFIX = "/api/v2/works"
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
router = APIRouter(prefix=WORKS_v2_PREFIX, tags=[Tags.WORKS_V2])
|
||||
|
||||
@@ -276,7 +279,7 @@ async def get_work_classification_by_work_id(
|
||||
|
||||
|
||||
@router.get(
|
||||
"/classification/work/search",
|
||||
"/classification/works/search",
|
||||
operation_id="getWorkClassificationsByWorkIds",
|
||||
summary="Returns the classifications of works based on their IDs.",
|
||||
)
|
||||
@@ -301,6 +304,10 @@ async def get_work_classifications_by_work_ids(
|
||||
) -> WorkClassificationPage:
|
||||
from inse.works.v2.service import get_work_classifications_by_work_ids
|
||||
|
||||
logger.debug(
|
||||
f"Fetching work classifications for work IDs: {work_ids}, page: {page}, size: {size}"
|
||||
)
|
||||
|
||||
return await get_work_classifications_by_work_ids(
|
||||
work_ids=work_ids or [],
|
||||
page=page,
|
||||
|
||||
@@ -16,7 +16,7 @@ from inse.models.openalex.author import Author
|
||||
from inse.models.openalex.topic import Topic
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
def _authors_nested_query(author_ids: List[str]) -> dict:
|
||||
@@ -478,6 +478,8 @@ async def get_work_classifications_by_work_ids(
|
||||
) -> WorkClassificationPage:
|
||||
prefixed = [_prefix_id(wid) for wid in work_ids]
|
||||
|
||||
logger.debug(f"Fetching work classifications for work IDs: {prefixed}")
|
||||
|
||||
response = await elasticsearch.search(
|
||||
ESIndex.WORK_CLASSIFICATIONS,
|
||||
source=[
|
||||
@@ -505,7 +507,10 @@ async def get_work_classifications_by_work_ids(
|
||||
if classification is not None:
|
||||
elements.append(classification)
|
||||
|
||||
return WorkClassificationPage(elements=elements, total=total, page=page, size=size)
|
||||
p = WorkClassificationPage(elements=elements, total=total, page=page, size=size)
|
||||
logger.debug(f"Returning WorkClassificationPage: {p}")
|
||||
|
||||
return p
|
||||
|
||||
|
||||
def _prefix_id(raw_id: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user