This commit is contained in:
Your Name
2026-04-17 03:36:03 +08:00
parent 3cc36a054c
commit d3223a75a4
5 changed files with 525 additions and 4 deletions

View File

@@ -6,7 +6,11 @@ from app.schemas.common import ApiResponse
from app.services.cluster_runtime_service import get_cluster_snapshot
from app.services.runtime_control_service import runtime_action
from app.services.runtime_status_service import get_runtime_preflight, get_runtime_status
from app.services.sync_push_service import ingest_runtime_projection
from app.services.sync_push_service import (
ack_detect_task_projection,
export_detect_task_projection,
ingest_runtime_projection,
)
from app.services.sync_record_service import get_sync_summary, list_sync_records
router = APIRouter(tags=["runtime"])
@@ -48,6 +52,18 @@ def runtime_sync_ingest(payload: dict, x_domaincheck_sync_token: Optional[str] =
return ApiResponse(code=0 if ok else 1, message=message, data=data)
@router.get("/runtime/task-export", response_model=ApiResponse)
def runtime_task_export(limit: int = 200, x_domaincheck_sync_token: Optional[str] = Header(default=None)) -> ApiResponse:
ok, message, data = export_detect_task_projection(limit=limit, shared_token=x_domaincheck_sync_token)
return ApiResponse(code=0 if ok else 1, message=message, data=data)
@router.post("/runtime/task-ack", response_model=ApiResponse)
def runtime_task_ack(payload: dict, x_domaincheck_sync_token: Optional[str] = Header(default=None)) -> ApiResponse:
ok, message, data = ack_detect_task_projection(payload, shared_token=x_domaincheck_sync_token)
return ApiResponse(code=0 if ok else 1, message=message, data=data)
@router.post("/runtime/actions/{action}", response_model=ApiResponse)
def runtime_action_trigger(action: str) -> ApiResponse:
ok, message, data = runtime_action(action)