backend bug fix

This commit is contained in:
xiaozhe.ma
2024-11-20 15:09:45 +09:00
parent 3b9f08b43d
commit 4563274789
3 changed files with 75 additions and 70 deletions

View File

@@ -190,15 +190,17 @@ def delete_flow(db: Session, flowid: str):
def edit_flow(
db: Session, flow: schemas.FlowBase
db: Session, domainurl: str, flow: schemas.FlowBase
) -> schemas.Flow:
db_flow = get_flow(db, flow.flowid)
if not db_flow:
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Flow not found")
#見つからない時新規作成
return create_flow(db,domainurl,flow)
update_data = flow.dict(exclude_unset=True)
for key, value in update_data.items():
setattr(db_flow, key, value)
setattr(db_flow, key, value)
db.add(db_flow)
db.commit()
@@ -214,8 +216,8 @@ def get_flows(db: Session, flowid: str):
def get_flow(db: Session, flowid: str):
flow = db.query(models.Flow).filter(models.Flow.flowid == flowid).first()
if not flow:
raise HTTPException(status_code=404, detail="Data not found")
# if not flow:
# raise HTTPException(status_code=404, detail="Data not found")
return flow
def get_flows_by_app(db: Session,domainurl: str, appid: str):