31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
# [DEF:health_router:Module]
|
|
# @TIER: STANDARD
|
|
# @SEMANTICS: health, monitoring, dashboards
|
|
# @PURPOSE: API endpoints for dashboard health monitoring and status aggregation.
|
|
# @LAYER: UI/API
|
|
# @RELATION: DEPENDS_ON -> health_service
|
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
from typing import List, Optional
|
|
from sqlalchemy.orm import Session
|
|
from ...core.database import get_db
|
|
from ...services.health_service import HealthService
|
|
from ...schemas.health import HealthSummaryResponse
|
|
from ...dependencies import has_permission
|
|
|
|
router = APIRouter(prefix="/api/health", tags=["Health"])
|
|
|
|
@router.get("/summary", response_model=HealthSummaryResponse)
|
|
async def get_health_summary(
|
|
environment_id: Optional[str] = Query(None),
|
|
db: Session = Depends(get_db),
|
|
_ = Depends(has_permission("plugin:migration", "READ"))
|
|
):
|
|
"""
|
|
@PURPOSE: Get aggregated health status for all dashboards.
|
|
@POST: Returns HealthSummaryResponse
|
|
"""
|
|
service = HealthService(db)
|
|
return await service.get_health_summary(environment_id=environment_id)
|
|
|
|
# [/DEF:health_router:Module] |