From 85327ce0b3e4cb33fb8b5b9ba14ff52235be005e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 8 Sep 2022 23:39:42 +0000 Subject: [PATCH] rename cal_aggregate -> aggregate --- api/ovdashboard_api/routers/__init__.py | 4 ++-- api/ovdashboard_api/routers/_common.py | 4 ++-- .../routers/{cal_aggregate.py => aggregate.py} | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) rename api/ovdashboard_api/routers/{cal_aggregate.py => aggregate.py} (75%) diff --git a/api/ovdashboard_api/routers/__init__.py b/api/ovdashboard_api/routers/__init__.py index 64f4c53..9fa4d4b 100644 --- a/api/ovdashboard_api/routers/__init__.py +++ b/api/ovdashboard_api/routers/__init__.py @@ -7,13 +7,13 @@ This file: Main API router definition. from fastapi import APIRouter from ..settings import SETTINGS -from . import cal_aggregate, calendar, image, text +from . import aggregate, calendar, image, text main_router = APIRouter(prefix=f"/{SETTINGS.api_v1_prefix}") main_router.include_router(text.router) main_router.include_router(image.router) main_router.include_router(calendar.router) -main_router.include_router(cal_aggregate.router) +main_router.include_router(aggregate.router) __all__ = [ "main_router", diff --git a/api/ovdashboard_api/routers/_common.py b/api/ovdashboard_api/routers/_common.py index 3a95969..8681689 100644 --- a/api/ovdashboard_api/routers/_common.py +++ b/api/ovdashboard_api/routers/_common.py @@ -88,9 +88,9 @@ class CalendarNameLister: @dataclass(frozen=True) -class CalAggregateLister: +class AggregateNameLister: """ - Can be called to create an iterator containing CalAggregate names. + Can be called to create an iterator containing aggregate calendar names. """ async def __call__(self) -> Iterator[str]: diff --git a/api/ovdashboard_api/routers/cal_aggregate.py b/api/ovdashboard_api/routers/aggregate.py similarity index 75% rename from api/ovdashboard_api/routers/cal_aggregate.py rename to api/ovdashboard_api/routers/aggregate.py index cedc272..ddac1f3 100644 --- a/api/ovdashboard_api/routers/cal_aggregate.py +++ b/api/ovdashboard_api/routers/aggregate.py @@ -1,5 +1,5 @@ """ -Router "cal_aggregate" provides: +Router "aggregate" provides: - listing aggregate calendars - finding aggregate calendars by name prefix @@ -13,16 +13,16 @@ from fastapi import APIRouter, Depends from ovdashboard_api.config import Config from ..dav_calendar import CalEvent, DavCalendar -from ._common import CalAggregateLister, PrefixFinder, PrefixUnique +from ._common import AggregateNameLister, PrefixFinder, PrefixUnique from .calendar import calendar_unique _logger = getLogger(__name__) router = APIRouter(prefix="/aggregate", tags=["calendar"]) -cal_aggregate_lister = CalAggregateLister() -cal_aggregate_finder = PrefixFinder(cal_aggregate_lister) -cal_aggregate_unique = PrefixUnique(cal_aggregate_finder) +aggregate_lister = AggregateNameLister() +aggregate_finder = PrefixFinder(aggregate_lister) +aggregate_unique = PrefixUnique(aggregate_finder) @router.on_event("startup") @@ -32,21 +32,21 @@ async def start_router() -> None: @router.get("/list", response_model=list[str]) async def list_aggregate_calendars( - names: Iterator[str] = Depends(cal_aggregate_lister), + names: Iterator[str] = Depends(aggregate_lister), ) -> list[str]: return list(names) @router.get("/find/{prefix}", response_model=list[str]) async def find_aggregate_calendars( - names: Iterator[str] = Depends(cal_aggregate_finder), + names: Iterator[str] = Depends(aggregate_finder), ) -> list[str]: return list(names) @router.get("/get/{prefix}", response_model=list[CalEvent]) async def get_aggregate_calendar( - name: str = Depends(cal_aggregate_unique), + name: str = Depends(aggregate_unique), ) -> list[CalEvent]: cfg = await Config.get() aggregate = cfg.calendar.aggregate[name]