Update setdemand
This commit is contained in:
8
main.py
8
main.py
@@ -869,14 +869,14 @@ async def fast_get_demand_schema(network: str) -> dict[str, dict[str, Any]]:
|
||||
return get_demand_schema(network)
|
||||
|
||||
@app.get("/getdemandproperties/")
|
||||
async def fastapi_get_demand_properties(network: str, demand: str) -> dict[str, Any]:
|
||||
return get_demand(network, demand)
|
||||
async def fastapi_get_demand_properties(network: str, junction: str) -> dict[str, Any]:
|
||||
return get_demand(network, junction)
|
||||
|
||||
# example: set_demand(p, ChangeSet({'junction': 'j1', 'demands': [{'demand': 10.0, 'pattern': None, 'category': 'x'}, {'demand': 20.0, 'pattern': None, 'category': None}]}))
|
||||
@app.post("/setdemandproperties/")
|
||||
async def fastapi_set_demand_properties(network: str, demand: str, req: Request) -> ChangeSet:
|
||||
async def fastapi_set_demand_properties(network: str, junction: str, req: Request) -> ChangeSet:
|
||||
props = await req.json()
|
||||
ps = { 'id' : demand } | props
|
||||
ps = { 'junction' : junction } | props
|
||||
return set_demand(network, ChangeSet(ps))
|
||||
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user