This commit is contained in:
WQY\qiong
2023-04-06 23:16:06 +08:00

10
main.py
View File

@@ -163,6 +163,10 @@ async def fastapi_undo(network: str):
async def fastapi_redo(network: str):
return execute_redo(network)
@app.get('/getsnapshots/')
def fastapi_list_snapshot(network: str) -> list[tuple[int, str]]:
return list_snapshot(network)
@app.get('/havesnapshot/')
async def fastapi_have_snapshot(network: str, tag: str) -> bool:
return have_snapshot(network, tag)
@@ -950,6 +954,12 @@ async def fastapi_get_tag_schema(network: str) -> dict[str, dict[str, Any]]:
async def fastapi_get_tag(network: str, t_type: str, id: str) -> dict[str, Any]:
return get_tag(network, t_type, id)
@app.get('/gettags/')
async def fastapi_get_tags(network: str) -> list[dict[str, Any]]:
tags = get_tags(network)
print(tags)
return tags
# example:
# set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': 'j1t' }))
# set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' }))