Add API to get all valve and pumps
This commit is contained in:
10
main.py
10
main.py
@@ -1077,6 +1077,11 @@ async def fastapi_set_pump_node2(network: str, pump: str, node2: str) -> ChangeS
|
||||
async def fastapi_get_pump_properties(network: str, pump: str) -> dict[str, Any]:
|
||||
return get_pump(network, pump)
|
||||
|
||||
# DingZQ, 2025-03-29
|
||||
@app.get('/getallpumpproperties/')
|
||||
async def fastapi_get_all_pump_properties(network: str) -> list[dict[str, Any]]:
|
||||
return get_all_pumps(network)
|
||||
|
||||
@app.post("/setpumpproperties/",response_model=None)
|
||||
async def fastapi_set_pump_properties(network: str, pump: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
@@ -1172,6 +1177,11 @@ async def fastapi_set_valve_setting(network: str, valve: str, setting: float) ->
|
||||
async def fastapi_get_valve_properties(network: str, valve: str) -> dict[str, Any]:
|
||||
return get_valve(network, valve)
|
||||
|
||||
# DingZQ, 2025-03-29
|
||||
@app.get('/getallvalveproperties/')
|
||||
async def fastapi_get_all_valve_properties(network: str) -> list[dict[str, Any]]:
|
||||
return get_all_valves(network)
|
||||
|
||||
@app.post("/setvalveproperties/",response_model=None)
|
||||
async def fastapi_set_valve_properties(network: str, valve: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
|
||||
Reference in New Issue
Block a user