Refine status api
This commit is contained in:
12
main.py
12
main.py
@@ -886,15 +886,15 @@ async def fastapi_set_demand_properties(network: str, junction: str, req: Reques
|
||||
async def fast_get_status_schema(network: str) -> dict[str, dict[str, Any]]:
|
||||
return get_status_schema(network)
|
||||
|
||||
@app.get("/getstatusproperties/")
|
||||
async def fastapi_get_status_properties(network: str, demand: str) -> dict[str, Any]:
|
||||
return get_status(network, demand)
|
||||
@app.get("/getstatus/")
|
||||
async def fastapi_get_status(network: str, link: str) -> dict[str, Any]:
|
||||
return get_status(network, link)
|
||||
|
||||
# example: set_status(p, ChangeSet({'link': 'p0', 'status': LINK_STATUS_OPEN, 'setting': 10.0}))
|
||||
@app.post("/setstatusproperties/")
|
||||
async def fastapi_set_status_properties(network: str, status: str, req: Request) -> ChangeSet:
|
||||
@app.post("/setstatus/")
|
||||
async def fastapi_set_status_properties(network: str, link: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
ps = { 'id' : status } | props
|
||||
ps = { 'id' : link } | props
|
||||
return set_status(network, ChangeSet(ps))
|
||||
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user