Add pickoperation

This commit is contained in:
DingZQ
2022-12-03 14:27:14 +08:00
parent e140ce14c6
commit 78bb270c05

14
main.py
View File

@@ -75,12 +75,14 @@ async def fastapi_copy_project(source: str, target: str):
return True
@app.post("/readinp/")
async def fastapi_read_inp(network: str, inp: str) -> None:
return read_inp(network, inp)
async def fastapi_read_inp(network: str, inp: str) -> bool:
read_inp(network, inp)
return True
@app.get("/dumpinp/")
async def fastapi_dump_inp(network: str, inp: str) -> None:
return dump_inp(network, inp)
async def fastapi_dump_inp(network: str, inp: str) -> bool:
dump_inp(network, inp)
return True
# 必须用这个PlainTextResponse不然每个key都有引号
@app.get("/runproject/", response_class = PlainTextResponse)
@@ -138,6 +140,10 @@ def fastapi_take_snapshot(network: str, tag: str) -> int | None:
def fastapi_pick_snapshot(network: str, tag: str, discard: bool = False) -> ChangeSet:
return pick_snapshot(network, tag, discard)
@app.post('/pickoperation/')
async def fastapi_pick_operation(network: str, operation: int, discard: bool = False) -> ChangeSet:
return pick_operation(network, operation, discard)
@app.get("/syncwithserver/")
async def fastapi_sync_with_server(network: str, operationid: int) -> ChangeSet:
return sync_with_server(network, operationid)