42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Overview dashboard aggregations — data for the UI Overview page."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from pydantic import BaseModel
|
|
|
|
from .deps import overview_service
|
|
from ...services import OverviewService
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
class OverviewResponse(BaseModel):
|
|
tenant_id: str
|
|
total_projects: int
|
|
total_requirements: int
|
|
total_tasks: int
|
|
total_tests: int
|
|
total_deployments: int
|
|
total_commits: int
|
|
jobs_running: int
|
|
jobs_queued: int
|
|
jobs_failed_24h: int
|
|
implementation_coverage_pct: float
|
|
test_coverage_pct: float
|
|
traceability_score_pct: float
|
|
project_health_pct: float
|
|
security_findings: int
|
|
failed_builds: int
|
|
active_ai_jobs: int
|
|
featured_projects: list[dict]
|
|
mock_fields: list[str]
|
|
|
|
|
|
@router.get("", response_model=OverviewResponse, summary="Overview metrics for the tenant dashboard")
|
|
async def get_overview(
|
|
svc: OverviewService = Depends(overview_service),
|
|
) -> OverviewResponse:
|
|
stats = await svc.overview()
|
|
return OverviewResponse(**stats.to_dict())
|