Update main.py

This commit is contained in:
DingZQ
2022-08-27 09:48:04 +08:00
parent b707664ffc
commit 633b7867f4
2 changed files with 19 additions and 0 deletions

Binary file not shown.

19
main.py
View File

@@ -40,6 +40,10 @@ async def fastapi_redo(network: str):
return True
@app.get("/haveproject/")
async def fastapi_have_project(network: str):
return have_project(network)
@app.post("/createproject/")
async def fastapi_create_project(network: str):
create_project(network)
@@ -48,6 +52,16 @@ async def fastapi_create_project(network: str):
print(network)
return network
@app.post("/closeproject/")
async def fastapi_close_project(network: str):
close_project(network)
return True
@app.post("/deleteproject/")
async def fastapi_delete_project(network: str):
delete_project(network)
return True
@app.get("/getnodes/")
async def fastapi_get_nodes(network: str):
nodeCount = get_count(network, NODE_COUNT)
@@ -63,6 +77,9 @@ async def fastapi_get_nodes(network: str):
async def fastapi_add_node(network: str, node: str):
idx = add_node(network, node, JUNCTION)
print(idx)
print("add node")
count = get_count(network, NODE_COUNT)
print(count.value)
return idx
@app.post("/deletenode/")
@@ -133,3 +150,5 @@ async def download_inp(name: str, response: Response):
else:
response.status_code = status.HTTP_400_BAD_REQUEST