diff --git a/api/ovdashboard_api/config.py b/api/ovdashboard_api/config.py index 6345dfe..23eaa04 100644 --- a/api/ovdashboard_api/config.py +++ b/api/ovdashboard_api/config.py @@ -21,6 +21,8 @@ _logger = getLogger(__name__) class TickerAPIConfig(BaseModel): """ Section "[ticker.api]" in "config.txt". + + Configuration for how the API generates the ticker content. """ file_name: str = "ticker" @@ -31,6 +33,8 @@ class TickerAPIConfig(BaseModel): class TickerUIConfig(BaseModel): """ Section "[ticker.ui]" in "config.txt". + + Configuration for how the UI displays the ticker content. """ display: bool = True @@ -41,6 +45,8 @@ class TickerUIConfig(BaseModel): class TickerConfig(BaseModel): """ Section "[ticker]" in "config.txt". + + Combined configuration for the ticker. """ api: TickerAPIConfig = TickerAPIConfig() @@ -61,11 +67,11 @@ class ImageConfig(BaseModel): class CalendarConfig(BaseModel): """ - Section "[calendar]" in "config.txt". + Sections "[calendar*]" in "config.txt". """ future_days: int = 365 - aggregate: dict[str, list[str]] = {} + aggregates: dict[str, list[str]] = {} class Config(BaseModel): @@ -99,7 +105,7 @@ class Config(BaseModel): ) cfg = cls() - cfg.calendar.aggregate["All Events"] = list(await caldav_list()) + cfg.calendar.aggregates["All Events"] = list(await caldav_list()) buffer = BytesIO() toml_dump(cfg.dict(), buffer) diff --git a/api/ovdashboard_api/routers/_common.py b/api/ovdashboard_api/routers/_common.py index 8681689..4009b81 100644 --- a/api/ovdashboard_api/routers/_common.py +++ b/api/ovdashboard_api/routers/_common.py @@ -96,7 +96,7 @@ class AggregateNameLister: async def __call__(self) -> Iterator[str]: cfg = await Config.get() - return iter(cfg.calendar.aggregate.keys()) + return iter(cfg.calendar.aggregates.keys()) @dataclass(frozen=True) diff --git a/api/ovdashboard_api/routers/aggregate.py b/api/ovdashboard_api/routers/aggregate.py index ddac1f3..cd04da3 100644 --- a/api/ovdashboard_api/routers/aggregate.py +++ b/api/ovdashboard_api/routers/aggregate.py @@ -49,7 +49,7 @@ async def get_aggregate_calendar( name: str = Depends(aggregate_unique), ) -> list[CalEvent]: cfg = await Config.get() - aggregate = cfg.calendar.aggregate[name] + aggregate = cfg.calendar.aggregates[name] calendars = ( DavCalendar(await calendar_unique(cal_prefix))