28 lines
962 B
Python
28 lines
962 B
Python
"""HTTP boundary for the System Health overview."""
|
|
|
|
from typing import Annotated
|
|
|
|
from fastapi import APIRouter, Depends, Response
|
|
|
|
from app.identity import require_permission
|
|
from app.system_health.dependencies import get_system_health_service
|
|
from app.system_health.models import SystemHealthOverviewResponse
|
|
from app.system_health.service import SystemHealthService
|
|
|
|
|
|
router = APIRouter(prefix="/api/system", tags=["system-health"])
|
|
SystemHealthUser = Annotated[dict, Depends(require_permission("system_health.view"))]
|
|
SystemHealthServiceDependency = Annotated[
|
|
SystemHealthService, Depends(get_system_health_service)
|
|
]
|
|
|
|
|
|
@router.get("/health-summary", response_model=SystemHealthOverviewResponse)
|
|
def get_system_health_overview(
|
|
current_user: SystemHealthUser,
|
|
service: SystemHealthServiceDependency,
|
|
response: Response,
|
|
) -> SystemHealthOverviewResponse:
|
|
response.headers["Cache-Control"] = "no-store"
|
|
return service.get_overview()
|