Patch both api and web sides
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from sqlalchemy.orm import Session
|
||||
from typing import List
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
@@ -11,7 +10,7 @@ from ..schemas import WorkflowCreate, WorkflowUpdate, WorkflowOut
|
||||
router = APIRouter(prefix="/workflows", tags=["Workflows"])
|
||||
|
||||
|
||||
@router.get("", response_model=List[WorkflowOut])
|
||||
@router.get("")
|
||||
def list_workflows(
|
||||
page: int = 1,
|
||||
limit: int = 50,
|
||||
@@ -62,8 +61,12 @@ def update_workflow(id: str, data: WorkflowUpdate, db: Session = Depends(get_db)
|
||||
raise HTTPException(status_code=404, detail="Workflow not found")
|
||||
|
||||
update_data = data.model_dump(exclude_unset=True)
|
||||
field_map = {
|
||||
"nodeCount": "node_count",
|
||||
"globalPrompt": "global_prompt",
|
||||
}
|
||||
for field, value in update_data.items():
|
||||
setattr(workflow, field, value)
|
||||
setattr(workflow, field_map.get(field, field), value)
|
||||
|
||||
workflow.updated_at = datetime.utcnow().isoformat()
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user