feat: allow inlet, outlet for pipes

This commit is contained in:
Timothy J. Baek
2024-05-30 21:43:32 -07:00
parent 8be45c7949
commit ef79179c7f
2 changed files with 26 additions and 9 deletions

10
main.py
View File

@@ -470,10 +470,7 @@ async def update_valves(pipeline_id: str, form_data: dict):
@app.post("/v1/{pipeline_id}/filter/inlet")
@app.post("/{pipeline_id}/filter/inlet")
async def filter_inlet(pipeline_id: str, form_data: FilterForm):
if (
pipeline_id not in app.state.PIPELINES
or app.state.PIPELINES[pipeline_id].get("type", "pipe") != "filter"
):
if pipeline_id not in app.state.PIPELINES:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Filter {pipeline_id} not found",
@@ -498,10 +495,7 @@ async def filter_inlet(pipeline_id: str, form_data: FilterForm):
@app.post("/v1/{pipeline_id}/filter/outlet")
@app.post("/{pipeline_id}/filter/outlet")
async def filter_outlet(pipeline_id: str, form_data: FilterForm):
if (
pipeline_id not in app.state.PIPELINES
or app.state.PIPELINES[pipeline_id].get("type", "pipe") != "filter"
):
if pipeline_id not in app.state.PIPELINES:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Filter {pipeline_id} not found",