From 32cb67df7257eb1e03cf78f85cc901afd53c0316 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Fri, 29 May 2026 12:15:05 +0200 Subject: [PATCH] Add topics by time endpoint --- service/src/main/inse/works/service.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/service/src/main/inse/works/service.py b/service/src/main/inse/works/service.py index 82665c20..f60328ae 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -50,3 +50,18 @@ async def get_all_author_works( principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), ): return await logic.get_all_author_works(author_id) + + +@router.get("/{author_id}/topics-by-time", + operation_id="getTopicsByTimeByAuthor", + response_model=model.TopicsByTime, + summary="Returns topics grouped by publication year for an author.") +async def get_topics_by_time_by_author( + author_id: Annotated[str, Path(description="The author id, for example A5023888391.")], + max_topics_per_year: Annotated[int, Query(description="The maximum number of topics per year.", ge=1, le=20)] = 3, + principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), +): + return await logic.get_topics_by_time_by_author( + author_id, + max_topics_per_year=max_topics_per_year, + )