Reorganize WNDB by responsibility and remove legacy scheme endpoints.\n\nRoute analysis and time-series access through project pools, preserve transactional realtime replacement, and refresh GIS materialized views after writes.\n\nAdd database architecture documentation, live pooling coverage, API contract updates, and executable container verification.\n\nBREAKING CHANGE: legacy scheme APIs and flat app.native.wndb module imports are removed.
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from typing import Any
|
|
|
|
from fastapi import APIRouter, Query
|
|
|
|
from app.services.tjnetwork import (
|
|
get_all_scada_info,
|
|
get_scada_info,
|
|
get_scada_info_schema,
|
|
)
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/network-schemas/scada-device", summary="获取 SCADA 设备结构")
|
|
async def get_scada_device_schema(
|
|
network: str = Query(..., description="管网名称(或数据库名称)"),
|
|
) -> dict[str, dict[str, Any]]:
|
|
return get_scada_info_schema(network)
|
|
|
|
|
|
@router.get("/scada-devices", summary="获取 SCADA 设备列表")
|
|
async def get_scada_devices(
|
|
network: str = Query(..., description="管网名称(或数据库名称)"),
|
|
) -> list[dict[str, Any]]:
|
|
return get_all_scada_info(network)
|
|
|
|
|
|
@router.get("/scada-devices/detail", summary="获取 SCADA 设备")
|
|
async def get_scada_device(
|
|
network: str = Query(..., description="管网名称(或数据库名称)"),
|
|
device_id: str = Query(..., description="SCADA 设备 ID"),
|
|
) -> dict[str, Any]:
|
|
return get_scada_info(network, device_id)
|