feat: add dashboard trend charts

This commit is contained in:
Christian Krakau-Louis
2026-05-22 20:52:47 +02:00
parent 1c8eaa5733
commit 8485514445
8 changed files with 426 additions and 37 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ router = APIRouter()
async def get_dashboard_statistics(
db: Session = Depends(get_db),
force_refresh: bool = Query(False, title="Force refresh of statistics"),
period_days: int = Query(30, title="Period in days for time-based statistics"),
period_days: int = Query(30, ge=1, le=365, title="Period in days for time-based statistics"),
) -> Dict[str, Any]:
"""
Get optimized statistics for the dashboard using cached data when possible.
@@ -34,7 +34,7 @@ async def get_dashboard_statistics(
stats_summarizer.invalidate_cache()
# Get statistics (from cache or calculate if needed)
stats = stats_summarizer.calculate_summary_statistics(db)
stats = stats_summarizer.calculate_summary_statistics(db, period_days=period_days)
# Add version and timestamp
stats["api_version"] = "1.0"
@@ -48,7 +48,7 @@ async def get_domain_statistics(
domain_id: str = Path(..., title="The domain ID or name"),
db: Session = Depends(get_db),
force_refresh: bool = Query(False, title="Force refresh of statistics"),
period_days: int = Query(30, title="Period in days for time-based statistics"),
period_days: int = Query(30, ge=1, le=365, title="Period in days for time-based statistics"),
) -> Dict[str, Any]:
"""
Get optimized statistics for a specific domain using cached data when possible.
@@ -69,7 +69,7 @@ async def get_domain_statistics(
stats_summarizer.invalidate_cache(domain_id)
# Get domain statistics (from cache or calculate if needed)
stats = stats_summarizer.calculate_summary_statistics(db, domain_id)
stats = stats_summarizer.calculate_summary_statistics(db, domain_id, period_days=period_days)
# Add version and timestamp
stats["api_version"] = "1.0"