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 return True
@app.post("/readinp/") @app.post("/readinp/")
async def fastapi_read_inp(network: str, inp: str) -> None: async def fastapi_read_inp(network: str, inp: str) -> bool:
return read_inp(network, inp) read_inp(network, inp)
return True
@app.get("/dumpinp/") @app.get("/dumpinp/")
async def fastapi_dump_inp(network: str, inp: str) -> None: async def fastapi_dump_inp(network: str, inp: str) -> bool:
return dump_inp(network, inp) dump_inp(network, inp)
return True
# 必须用这个PlainTextResponse不然每个key都有引号 # 必须用这个PlainTextResponse不然每个key都有引号
@app.get("/runproject/", response_class = PlainTextResponse) @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: def fastapi_pick_snapshot(network: str, tag: str, discard: bool = False) -> ChangeSet:
return pick_snapshot(network, tag, discard) 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/") @app.get("/syncwithserver/")
async def fastapi_sync_with_server(network: str, operationid: int) -> ChangeSet: async def fastapi_sync_with_server(network: str, operationid: int) -> ChangeSet:
return sync_with_server(network, operationid) return sync_with_server(network, operationid)