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]]:
|
||||
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]:
|
||||
return get_tag(network, t_type, id)
|
||||
|
||||
# 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' }))
|
||||
@app.post('/settagproperties/')
|
||||
async def set_tag(network: str, req: Request) -> ChangeSet:
|
||||
@app.post('/settag/')
|
||||
async def fastapi_set_tag(network: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
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)
|
||||
|
||||
@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 = {
|
||||
'id' : pattern,
|
||||
'factors' : factors
|
||||
}
|
||||
} | props
|
||||
return add_pattern(network, ChangeSet(ps))
|
||||
|
||||
@app.post("/deletepattern/")
|
||||
|
||||
Reference in New Issue
Block a user