Fixed addpattern error
This commit is contained in:
12
main.py
12
main.py
@@ -849,15 +849,15 @@ async def fastapi_delete_link(network: str, link: str) -> ChangeSet:
|
|||||||
async def fastapi_get_tag_schema(network: str) -> dict[str, dict[str, Any]]:
|
async def fastapi_get_tag_schema(network: str) -> dict[str, dict[str, Any]]:
|
||||||
return get_tag_schema(network)
|
return get_tag_schema(network)
|
||||||
|
|
||||||
@app.get('/gettagproperties/')
|
@app.get('/gettag/')
|
||||||
async def fastapi_get_tag(network: str, t_type: str, id: 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)
|
return get_tag(network, t_type, id)
|
||||||
|
|
||||||
# example:
|
# example:
|
||||||
# set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': 'j1t' }))
|
# 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' }))
|
# set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' }))
|
||||||
@app.post('/settagproperties/')
|
@app.post('/settag/')
|
||||||
async def set_tag(network: str, req: Request) -> ChangeSet:
|
async def fastapi_set_tag(network: str, req: Request) -> ChangeSet:
|
||||||
props = await req.json()
|
props = await req.json()
|
||||||
return set_tag(network, ChangeSet(props))
|
return set_tag(network, ChangeSet(props))
|
||||||
|
|
||||||
@@ -905,11 +905,11 @@ async def fast_get_pattern_schema(network: str) -> dict[str, dict[str, Any]]:
|
|||||||
return get_pattern_schema(network)
|
return get_pattern_schema(network)
|
||||||
|
|
||||||
@app.post("/addpattern/")
|
@app.post("/addpattern/")
|
||||||
async def fastapi_add_pattern(network: str, pattern: str, factors: list[float]) -> ChangeSet:
|
async def fastapi_add_pattern(network: str, pattern: str, req: Request) -> ChangeSet:
|
||||||
|
props = await req.json()
|
||||||
ps = {
|
ps = {
|
||||||
'id' : pattern,
|
'id' : pattern,
|
||||||
'factors' : factors
|
} | props
|
||||||
}
|
|
||||||
return add_pattern(network, ChangeSet(ps))
|
return add_pattern(network, ChangeSet(ps))
|
||||||
|
|
||||||
@app.post("/deletepattern/")
|
@app.post("/deletepattern/")
|
||||||
|
|||||||
Reference in New Issue
Block a user