Files
gatekeeper/app/controllers/calendarManager.py
T
ahtlon 03a08c7328
Test python action / test (push) Successful in 45s
Check flake syntax / flake-check (push) Successful in 2m28s
Rename some endpoints
2026-11-22 13:57:07 +01:00

44 lines
1.1 KiB
Python

import logging
from fastapi import APIRouter, Depends, HTTPException
from app.services.auth import auth_is_admin
from app.services.caldav import get_caldav_handler
logger = logging.getLogger(__name__)
calendar_router = APIRouter(
prefix="/api/v1/calendar",
tags=["Calendar diagnostics"],
dependencies=[Depends(auth_is_admin)],
)
@calendar_router.get("/status")
def cal_is_active():
return get_caldav_handler() is not None
@calendar_router.get("/activeEvents")
def cal_get_active_events():
handler = get_caldav_handler()
if handler is None:
raise HTTPException(503, "Caldav handler not initialized")
return handler.get_active_events()
@calendar_router.get("/futureEvents")
def cal_get_future_events():
handler = get_caldav_handler()
if handler is None:
raise HTTPException(503, "Caldav handler not initialized")
return handler.get_future_events()
@calendar_router.get("/activeGroups")
def cal_get_active_groups():
handler = get_caldav_handler()
if handler is None:
raise HTTPException(503, "Caldav handler not initialized")
return handler.get_active_groups()