This commit is contained in:
DingZQ
2022-10-15 15:08:21 +08:00
parent 80ecb4a212
commit 6782fae984

View File

@@ -2,6 +2,7 @@ import os
import io import io
from typing import * from typing import *
from fastapi import FastAPI, File, UploadFile from fastapi import FastAPI, File, UploadFile
import pip
from pydantic import BaseModel from pydantic import BaseModel
from starlette.responses import FileResponse, JSONResponse from starlette.responses import FileResponse, JSONResponse
from fastapi import FastAPI, Response, status 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/") @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: 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/") @app.post("/deletepipe/")
async def fastapi_delete_pipe(network: str, pipe: str) -> ChangeSet: async def fastapi_delete_pipe(network: str, pipe: str) -> ChangeSet: