Refine junction methods
This commit is contained in:
31
main.py
31
main.py
@@ -174,39 +174,54 @@ async def fastapi_delete_junction(network: str, junction: str) -> ChangeSet:
|
||||
|
||||
@app.get("/getjunctionelevation/")
|
||||
async def fastapi_get_junction_elevation(network: str, junction: str) -> float:
|
||||
ps = get_junction_properties(network, junction)
|
||||
ps = get_junction(network, junction)
|
||||
return ps['elevation']
|
||||
|
||||
@app.get("/getjunctioncoord/")
|
||||
async def fastapi_get_junction_coord(network: str, junction: str) -> dict[str, float]:
|
||||
ps = get_junction_properties(network, junction)
|
||||
ps = get_junction(network, junction)
|
||||
return ps['coord']
|
||||
|
||||
@app.get("/getjunctiondemand/")
|
||||
async def fastapi_get_junction_demand(network: str, junction: str) -> float:
|
||||
ps = get_junction_properties(network, junction)
|
||||
ps = get_junction(network, junction)
|
||||
return ps['demand']
|
||||
|
||||
@app.get("/getjunctionpattern/")
|
||||
async def fastapi_get_junction_pattern(network: str, junction: str) -> str:
|
||||
ps = get_junction_properties(network, junction)
|
||||
ps = get_junction(network, junction)
|
||||
return ps['pattern']
|
||||
|
||||
@app.post("/setjunctionelevation/")
|
||||
async def fastapi_set_junction_elevation(network: str, junction: str, elevation: float) -> ChangeSet:
|
||||
return set_junction_elevation(network, junction, elevation)
|
||||
props = {}
|
||||
props['elevation'] = elevation
|
||||
|
||||
return set_junction(network, junction, props)
|
||||
|
||||
@app.post("/setjunctioncoord/")
|
||||
async def fastapi_set_junction_coord(network: str, junction: str, x: float, y: float) -> ChangeSet:
|
||||
return set_junction_coord(network, junction, x, y)
|
||||
props = {}
|
||||
coord = {}
|
||||
coord['x'] = x
|
||||
coord['y'] = y
|
||||
props['coord'] = coord
|
||||
|
||||
return set_junction(network, junction, x, y)
|
||||
|
||||
@app.post("/setjunctiondemand/")
|
||||
async def fastapi_set_junction_demand(network: str, junction: str, demand: float) -> ChangeSet:
|
||||
return set_junction_demand(network, junction, demand)
|
||||
props = {}
|
||||
props['demand'] = demand
|
||||
|
||||
return set_junction(network, junction, props)
|
||||
|
||||
@app.post("/setjunctionpattern/")
|
||||
async def fastapi_set_junction_pattern(network: str, junction: str, pattern: str) -> ChangeSet:
|
||||
return set_junction_pattern(network, junction, pattern)
|
||||
props = {}
|
||||
props['pattern'] = pattern
|
||||
|
||||
return set_junction(network, junction, props)
|
||||
|
||||
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user