This commit is contained in:
DingZQ
2022-08-21 21:39:53 +08:00
parent 7ca9cb5d28
commit f8010a3f0d
2 changed files with 22 additions and 0 deletions

Binary file not shown.

22
main.py
View File

@@ -65,6 +65,28 @@ async def fastapi_count_node(network: str):
print(count) print(count)
return count.value return count.value
@app.post("/setnodecoord/")
async def fastapi_set_node_coord(network: str, node: str, x: int, y: int):
set_node_coord(network, node, x, y)
return True
@app.post("/addlink/")
async def fastapi_add_link(network: str, link: str, fromNode: str, toNode: str):
idx = add_link(network, link, PIPE, fromNode, toNode)
print(idx)
return idx
@app.post("/deletelink/")
async def fastapi_delete_link(network: str, link: str):
delete_link(network, link)
return True
@app.get("/countlink/")
async def fastapi_count_link(network: str):
count = get_count(network, LINK_COUNT)
print(count)
return count.value
@app.post("/uploadinp/", status_code=status.HTTP_200_OK) @app.post("/uploadinp/", status_code=status.HTTP_200_OK)
async def upload_inp(file: bytes = File(), name: str = None): async def upload_inp(file: bytes = File(), name: str = None):
filePath = inpDir + str(name) filePath = inpDir + str(name)