修复丢失的api;重新规划api结构

This commit is contained in:
2026-01-22 18:15:53 +08:00
parent 0d139f96f8
commit d21966e985
14 changed files with 710 additions and 151 deletions

View File

@@ -30,5 +30,26 @@ async def fastapi_set_demand_properties(
############################################################
# water distribution 36.[Water Distribution]
############################################################
# This section was empty in main.py, so skipping unless found elsewhere or needed.
# If there are specific Water Distribution endpoints they should go here.
@router.get("/calculatedemandtonodes/")
async def fastapi_calculate_demand_to_nodes(
network: str, req: Request
) -> dict[str, float]:
props = await req.json()
demand = props["demand"]
nodes = props["nodes"]
return calculate_demand_to_nodes(network, demand, nodes)
@router.get("/calculatedemandtoregion/")
async def fastapi_calculate_demand_to_region(
network: str, req: Request
) -> dict[str, float]:
props = await req.json()
demand = props["demand"]
region = props["region"]
return calculate_demand_to_region(network, demand, region)
@router.get("/calculatedemandtonetwork/")
async def fastapi_calculate_demand_to_network(
network: str, demand: float
) -> dict[str, float]:
return calculate_demand_to_network(network, demand)