feat: extend operational investigation workflows
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Independent sample API for synthetic work orders and monitoring data."""
|
||||
"""Project-scoped peripheral work orders, monitoring history and explicit test data."""
|
||||
from typing import get_args
|
||||
from uuid import UUID
|
||||
|
||||
@@ -34,8 +34,8 @@ async def store(request: Request, who: Identity = Depends(identity),
|
||||
|
||||
|
||||
def create_app(settings: SampleSettings | None = None) -> FastAPI:
|
||||
app = FastAPI(title="TJWater 外围系统模拟接入", version="1.0.0",
|
||||
description="测试监测与核查反馈样板,不是正式工单平台或设备控制服务。")
|
||||
app = FastAPI(title="TJWater 外围系统接入", version="1.0.0",
|
||||
description="按项目管理业务工单与反馈、读取监测历史;测试数据保留独立来源标记。")
|
||||
app.state.settings = settings or SampleSettings()
|
||||
app.add_middleware(CORSMiddleware, allow_origins=app.state.settings.cors_origins,
|
||||
allow_credentials=False, allow_methods=["GET", "POST", "PATCH", "DELETE"],
|
||||
@@ -51,7 +51,7 @@ def create_app(settings: SampleSettings | None = None) -> FastAPI:
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
return {"service": "peripheral-sample", "origin": "synthetic", "storage": "postgresql",
|
||||
return {"service": "peripheral-sample", "origin": "system_data", "storage": "postgresql",
|
||||
"status": "up", "storage_verified": False}
|
||||
|
||||
prefix = "/api/sample/v1"
|
||||
@@ -59,7 +59,7 @@ def create_app(settings: SampleSettings | None = None) -> FastAPI:
|
||||
|
||||
@app.get(prefix + "/context", response_model=Context, responses=errors)
|
||||
def context(request: Request, who: Identity = Depends(identity), db=Depends(store)):
|
||||
return {"protocol_version": "tjwater-peripheral-sample@1", "origin": "synthetic",
|
||||
return {"protocol_version": "tjwater-peripheral-sample@1", "origin": "system_data",
|
||||
"project_id": who.project_id, "user_id": who.user_id, "can_write": who.can_write,
|
||||
"scenarios": list(get_args(Scenario)) if request.app.state.settings.enable_faults else ["normal"],
|
||||
"state_transitions": TRANSITIONS, "managed_resources": db.managed_resource_capabilities()}
|
||||
|
||||
Reference in New Issue
Block a user