Refine control rule
This commit is contained in:
18
main.py
18
main.py
@@ -942,19 +942,19 @@ async def fastapi_set_curve_properties(network: str, curve: str, req: Request) -
|
||||
############################################################
|
||||
# control 13.[CONTROLS]
|
||||
############################################################
|
||||
@app.get('/getcontrolschema')
|
||||
@app.get('/getcontrolschema/')
|
||||
async def fastapi_get_control_schema(network: str) -> dict[str, dict[str, Any]]:
|
||||
return get_control_schema(network)
|
||||
|
||||
@app.get("/getcontrolproperties/")
|
||||
async def fastapi_get_control_properties(control: str) -> dict[str, Any]:
|
||||
return get_control(control)
|
||||
async def fastapi_get_control_properties(network: str) -> dict[str, Any]:
|
||||
return get_control(network)
|
||||
|
||||
# example: set_control(p, ChangeSet({'control': 'x'}))
|
||||
@app.post("/setcontrolproperties/")
|
||||
async def fastapi_set_control(control: str, req: Request) -> ChangeSet:
|
||||
async def fastapi_set_control(network: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
return set_control(control, ChangeSet(props))
|
||||
return set_control(network, ChangeSet(props))
|
||||
|
||||
############################################################
|
||||
# rule 14.[RULES]
|
||||
@@ -965,14 +965,14 @@ async def fastapi_get_rule_schema(network: str) -> dict[str, dict[str, Any]]:
|
||||
return get_rule_schema(network)
|
||||
|
||||
@app.get("/getruleproperties/")
|
||||
async def fastapi_get_rule(rule: str) -> dict[str, Any]:
|
||||
return get_rule(rule)
|
||||
async def fastapi_get_rule(network: str) -> dict[str, Any]:
|
||||
return get_rule(network)
|
||||
|
||||
# example: set_rule(p, ChangeSet({'rule': 'x'}))
|
||||
@app.post("/setruleproperties/")
|
||||
async def fastapi_set_rule(rule: str, req: Request) -> ChangeSet:
|
||||
async def fastapi_set_rule(network: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
return set_rule(rule, props)
|
||||
return set_rule(network, props)
|
||||
|
||||
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user