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, + )