From 9d6b68543995e11c0e61c7c8d3a7c976ec97632d Mon Sep 17 00:00:00 2001 From: DingZQ Date: Thu, 6 Apr 2023 22:16:05 +0800 Subject: [PATCH 1/3] Add get_tags --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index cf83010..979069e 100644 --- a/main.py +++ b/main.py @@ -950,6 +950,10 @@ 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]]: + return get_tags(network) + # 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' })) From 8d15df4a3b1ad62cbe3c66c195f4338e065637d2 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Thu, 6 Apr 2023 22:26:01 +0800 Subject: [PATCH 2/3] Print tags --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 979069e..d724460 100644 --- a/main.py +++ b/main.py @@ -952,7 +952,9 @@ async def fastapi_get_tag(network: str, t_type: str, id: str) -> dict[str, Any]: @app.get('/gettags/') async def fastapi_get_tags(network: str) -> list[dict[str, Any]]: - return get_tags(network) + tags = get_tags(network) + print(tags) + return tags # example: # set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': 'j1t' })) From 098ba98a7c3df829405ace46d69fc680ec61f3d6 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Thu, 6 Apr 2023 23:14:05 +0800 Subject: [PATCH 3/3] Refine --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index d724460..354885f 100644 --- a/main.py +++ b/main.py @@ -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)