feat(api): standardize REST contracts and auth

This commit is contained in:
2026-07-30 20:38:51 +08:00
parent ae1a657554
commit ba947b616b
86 changed files with 54193 additions and 990 deletions
+10 -10
View File
@@ -18,7 +18,7 @@ router = APIRouter()
############################################################
@router.get(
"/getdemandschema",
"/network-schemas/demand",
summary="获取需水量属性架构",
description="获取指定水网中需水量(Demand)的属性架构定义"
)
@@ -32,7 +32,7 @@ async def fastapi_get_demand_schema(network: str = Query(..., description="管
@router.get(
"/getdemandproperties/",
"/demands/properties",
summary="获取需水量属性",
description="获取指定水网中节点的需水量属性信息"
)
@@ -49,8 +49,8 @@ async def fastapi_get_demand_properties(
# example: set_demand(p, ChangeSet({'junction': 'j1', 'demands': [{'demand': 10.0, 'pattern': None, 'category': 'x'}, {'demand': 20.0, 'pattern': None, 'category': None}]}))
@router.post(
"/setdemandproperties/",
@router.patch(
"/demands/properties",
response_model=None,
summary="设置需水量属性",
description="设置指定水网中节点的需水量属性信息"
@@ -72,8 +72,8 @@ async def fastapi_set_demand_properties(
############################################################
# water distribution 36.[Water Distribution]
############################################################
@router.get(
"/calculatedemandtonodes/",
@router.post(
"/demands/to-nodes",
summary="计算需水量到节点分配",
description="将总需水量按指定方式分配到多个节点"
)
@@ -97,8 +97,8 @@ async def fastapi_calculate_demand_to_nodes(
nodes = props["nodes"]
return calculate_demand_to_nodes(network, demand, nodes)
@router.get(
"/calculatedemandtoregion/",
@router.post(
"/demands/to-region",
summary="计算需水量到区域分配",
description="将总需水量按区域特征分配到该区域内的节点"
)
@@ -122,8 +122,8 @@ async def fastapi_calculate_demand_to_region(
region = props["region"]
return calculate_demand_to_region(network, demand, region)
@router.get(
"/calculatedemandtonetwork/",
@router.post(
"/demands/to-network",
summary="计算需水量到整网分配",
description="将需水量均匀分配到整个水网的所有需水节点"
)