diff --git a/main.py b/main.py index 5ab0cb8..f738806 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import os import io from typing import * from fastapi import FastAPI, File, UploadFile +import pip from pydantic import BaseModel from starlette.responses import FileResponse, JSONResponse from fastapi import FastAPI, Response, status @@ -491,7 +492,12 @@ async def fast_get_pipe_schema(network: str) -> dict[str, dict[str, Any]]: @app.post("/addpipe/") async def fastapi_add_pipe(network: str, pipe: str, node1: str, node2: str, length: float = 0, diameter: float = 0, roughness: float = 0, minorloss: float = 0, status: str = PIPE_STATUS_OPEN) -> ChangeSet: - return add_pipe(network, pipe, node1, node2, length, diameter, roughness, minorloss, status) + + props : dict[str, any] = {} + props['id'] = pip + props['node1'] = node1 + props['node2'] = node2 + return add_pipe(network, ChangeSet(props)) @app.post("/deletepipe/") async def fastapi_delete_pipe(network: str, pipe: str) -> ChangeSet: