Add node methods
This commit is contained in:
30
main.py
30
main.py
@@ -53,6 +53,10 @@ async def fastapi_create_project(network: str):
|
|||||||
print(network)
|
print(network)
|
||||||
return network
|
return network
|
||||||
|
|
||||||
|
@app.get("/isprojectopen/")
|
||||||
|
async def fastapi_is_project_open(network: str):
|
||||||
|
return is_project_open(network)
|
||||||
|
|
||||||
@app.post("/openproject/")
|
@app.post("/openproject/")
|
||||||
async def fastapi_open_project(network: str):
|
async def fastapi_open_project(network: str):
|
||||||
open_project(network)
|
open_project(network)
|
||||||
@@ -70,11 +74,35 @@ async def fastapi_delete_project(network: str):
|
|||||||
delete_project(network)
|
delete_project(network)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# element operations
|
@app.post("/copyproject/")
|
||||||
|
async def fastapi_copy_project(source: str, target: str):
|
||||||
|
copy_project(source, target)
|
||||||
|
return True
|
||||||
|
|
||||||
|
# node
|
||||||
@app.get("/getnodes/")
|
@app.get("/getnodes/")
|
||||||
async def fastapi_get_nodes(network: str) -> list[str]:
|
async def fastapi_get_nodes(network: str) -> list[str]:
|
||||||
return get_nodes(network)
|
return get_nodes(network)
|
||||||
|
|
||||||
|
@app.get("/isnode/")
|
||||||
|
async def fastapi_is_node(network: str, node: str) -> bool:
|
||||||
|
return is_node(network, node)
|
||||||
|
|
||||||
|
@app.get("/isjunction/")
|
||||||
|
async def fastapi_is_junction(network: str, node: str) -> bool:
|
||||||
|
return is_junction(network, node)
|
||||||
|
|
||||||
|
@app.get("/isreservoir/")
|
||||||
|
async def fastapi_is_reservoir(network: str, node: str) -> bool:
|
||||||
|
return is_reservoir(network, node)
|
||||||
|
|
||||||
|
@app.get("/istank/")
|
||||||
|
async def fastapi_is_tank(network: str, node: str) -> bool:
|
||||||
|
return is_tank(network, node)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# junction
|
# junction
|
||||||
@app.post("/addjunction/")
|
@app.post("/addjunction/")
|
||||||
async def fastapi_add_junction(network: str, junction: str, x: float, y: float, z: float) -> ChangeSet:
|
async def fastapi_add_junction(network: str, junction: str, x: float, y: float, z: float) -> ChangeSet:
|
||||||
|
|||||||
Reference in New Issue
Block a user