Skip to content

Commit

Permalink
fix: validation (#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl authored Mar 18, 2024
1 parent bbaed9f commit c4a87b7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions keep/api/routes/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,20 @@ def run_workflow(
# Finally, run it
try:
# if its event that was triggered by the UI with the Modal
if "test-workflow" in body.get("fingerprint", ""):
if "test-workflow" in body.get("fingerprint", "") or not body:
# some random
body["id"] = body.get("fingerprint")
body["id"] = body.get("fingerprint", "manual-run")
body["name"] = body.get("fingerprint", "manual-run")
body["lastReceived"] = datetime.datetime.now(
tz=datetime.timezone.utc
).isoformat()
alert = AlertDto(**body)
try:
alert = AlertDto(**body)
except TypeError:
raise HTTPException(
status_code=400,
detail="Invalid alert format",
)
workflow_execution_id = workflowmanager.scheduler.handle_manual_event_workflow(
workflow_id, tenant_id, created_by, alert
)
Expand Down

0 comments on commit c4a87b7

Please sign in to comment.