fix(works_v2): fixed endpoint typo
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Mats Paul Tončik
2026-07-17 15:01:16 +02:00
parent a0628121a3
commit 7bf2b57b95
2 changed files with 15 additions and 3 deletions
+8 -1
View File
@@ -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,
+7 -2
View File
@@ -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: