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)
|
||||
return network
|
||||
|
||||
@app.get("/isprojectopen/")
|
||||
async def fastapi_is_project_open(network: str):
|
||||
return is_project_open(network)
|
||||
|
||||
@app.post("/openproject/")
|
||||
async def fastapi_open_project(network: str):
|
||||
open_project(network)
|
||||
@@ -70,11 +74,35 @@ async def fastapi_delete_project(network: str):
|
||||
delete_project(network)
|
||||
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/")
|
||||
async def fastapi_get_nodes(network: str) -> list[str]:
|
||||
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
|
||||
@app.post("/addjunction/")
|
||||
async def fastapi_add_junction(network: str, junction: str, x: float, y: float, z: float) -> ChangeSet:
|
||||
|
||||
Reference in New Issue
Block a user