rename cal_aggregate -> aggregate

This commit is contained in:
Jörn-Michael Miehe 2022-09-08 23:39:42 +00:00
parent 8b35bb7044
commit 85327ce0b3
3 changed files with 12 additions and 12 deletions

View file

@ -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",

View file

@ -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]:

View file

@ -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]