router startup log

This commit is contained in:
Jörn-Michael Miehe 2022-09-08 14:07:33 +00:00
parent 43271bb6e3
commit 8b35bb7044
2 changed files with 16 additions and 0 deletions

View file

@ -6,6 +6,7 @@ Router "cal_aggregate" provides:
- getting aggregate calendar events by name prefix
"""
from logging import getLogger
from typing import Iterator
from fastapi import APIRouter, Depends
@ -15,6 +16,8 @@ from ..dav_calendar import CalEvent, DavCalendar
from ._common import CalAggregateLister, PrefixFinder, PrefixUnique
from .calendar import calendar_unique
_logger = getLogger(__name__)
router = APIRouter(prefix="/aggregate", tags=["calendar"])
cal_aggregate_lister = CalAggregateLister()
@ -22,6 +25,11 @@ cal_aggregate_finder = PrefixFinder(cal_aggregate_lister)
cal_aggregate_unique = PrefixUnique(cal_aggregate_finder)
@router.on_event("startup")
async def start_router() -> None:
_logger.debug(f"{router.prefix} router starting.")
@router.get("/list", response_model=list[str])
async def list_aggregate_calendars(
names: Iterator[str] = Depends(cal_aggregate_lister),

View file

@ -6,6 +6,7 @@ Router "calendar" provides:
- getting calendar events by calendar name prefix
"""
from logging import getLogger
from typing import Iterator
from fastapi import APIRouter, Depends
@ -13,6 +14,8 @@ from fastapi import APIRouter, Depends
from ..dav_calendar import CalEvent, DavCalendar
from ._common import CalendarNameLister, PrefixFinder, PrefixUnique
_logger = getLogger(__name__)
router = APIRouter(prefix="/calendar", tags=["calendar"])
calendar_lister = CalendarNameLister()
@ -20,6 +23,11 @@ calendar_finder = PrefixFinder(calendar_lister)
calendar_unique = PrefixUnique(calendar_finder)
@router.on_event("startup")
async def start_router() -> None:
_logger.debug(f"{router.prefix} router starting.")
@router.get("/list", response_model=list[str])
async def list_calendars(
names: Iterator[str] = Depends(calendar_lister),