23 行
732 B
Python
23 行
732 B
Python
"""Dashboard route handlers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from backend.routes.common import handle_request
|
|
from backend.services.dashboard_service import DashboardService
|
|
from core.identity import RequestContext
|
|
from core.security import require_authenticated
|
|
from database.db_helper import Database, load_database_settings
|
|
|
|
|
|
def get_dashboard_summary(
|
|
ctx: RequestContext,
|
|
service: DashboardService | None = None,
|
|
database: Database | None = None,
|
|
) -> dict:
|
|
dashboard_service = service or DashboardService(database or Database(load_database_settings()))
|
|
|
|
def action() -> dict:
|
|
require_authenticated(ctx)
|
|
return dashboard_service.get_summary()
|
|
|
|
return handle_request(ctx, action)
|