From 7bf2b57b95caf6d372973cdf8ba0cf6f17ded73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Fri, 17 Jul 2026 15:01:16 +0200 Subject: [PATCH] fix(works_v2): fixed endpoint typo --- service/src/main/inse/works/v2/router.py | 9 ++++++++- service/src/main/inse/works/v2/service.py | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/service/src/main/inse/works/v2/router.py b/service/src/main/inse/works/v2/router.py index 10f53e22..dc430ae7 100644 --- a/service/src/main/inse/works/v2/router.py +++ b/service/src/main/inse/works/v2/router.py @@ -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, diff --git a/service/src/main/inse/works/v2/service.py b/service/src/main/inse/works/v2/service.py index de03c28b..79e310a2 100644 --- a/service/src/main/inse/works/v2/service.py +++ b/service/src/main/inse/works/v2/service.py @@ -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: