bugfix edit_flow

This commit is contained in:
2024-12-09 16:11:58 +09:00
parent 21e0b9d6df
commit b874d0c776
3 changed files with 68 additions and 8 deletions

View File

@@ -293,34 +293,41 @@ async def flow_create(
@r.put(
"/flow/{flowid}", response_model=Flow|None, response_model_exclude_none=True
"/flow", tags=["App"],
response_model=ApiReturnModel[Flow|None],
response_model_exclude_none=True
)
async def flow_edit(
request: Request,
flowid: str,
flow: FlowIn,
user=Depends(get_current_active_user),
db=Depends(get_db),
):
try:
domain = domainService.get_default_domain(db, user.id) #get_activedomain(db, user.id)
domain = domainService.get_default_domain(db, user.id)
if not domain:
return None
return edit_flow(db,domain.url, flow,user.id)
return ApiReturnModel(data = None)
return ApiReturnModel(data = appService.edit_flow(db,domain.url, flow,user.id))
except Exception as e:
raise APIException('platform:flow',request.url._url,f"Error occurred while edit flow:",e)
@r.delete(
"/flow/{flowid}", response_model=Flow, response_model_exclude_none=True
"/flow/{flowid}", tags=["App"],
response_model=ApiReturnModel[Flow|None],
response_model_exclude_none=True
)
async def flow_delete(
request: Request,
flowid: str,
user=Depends(get_current_active_user),
db=Depends(get_db),
):
try:
return delete_flow(db, flowid)
domain = domainService.get_default_domain(db, user.id)
if not domain:
return ApiReturnModel(data = None)
return ApiReturnModel(data = appService.delete_flow(db, flowid))
except Exception as e:
raise APIException('platform:flow',request.url._url,f"Error occurred while delete flow:",e)