dev
This commit is contained in:
23
domain-api/app/api/routes/runtime.py
Normal file
23
domain-api/app/api/routes/runtime.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.schemas.common import ApiResponse
|
||||
from app.services.runtime_control_service import runtime_action
|
||||
from app.services.runtime_status_service import get_runtime_preflight, get_runtime_status
|
||||
|
||||
router = APIRouter(tags=["runtime"])
|
||||
|
||||
|
||||
@router.get("/runtime/status", response_model=ApiResponse)
|
||||
def runtime_status() -> ApiResponse:
|
||||
return ApiResponse(data=get_runtime_status())
|
||||
|
||||
|
||||
@router.get("/runtime/preflight", response_model=ApiResponse)
|
||||
def runtime_preflight() -> ApiResponse:
|
||||
return ApiResponse(data=get_runtime_preflight())
|
||||
|
||||
|
||||
@router.post("/runtime/actions/{action}", response_model=ApiResponse)
|
||||
def runtime_action_trigger(action: str) -> ApiResponse:
|
||||
ok, message, data = runtime_action(action)
|
||||
return ApiResponse(code=0 if ok else 1, message=message, data=data)
|
||||
Reference in New Issue
Block a user