Skip to content

Commit 0f0cd5c

Browse files
authored
fix(workflow): deleting the only workflow in the project deletes the project (#2318)
Signed-off-by: Sylwester Piskozub <[email protected]>
1 parent 27f88e4 commit 0f0cd5c

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

app/controlplane/pkg/data/workflow.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,21 +406,11 @@ func (r *WorkflowRepo) SoftDelete(ctx context.Context, id uuid.UUID) (err error)
406406
}
407407

408408
// Soft delete workflow
409-
wf, err := tx.Workflow.UpdateOneID(id).SetDeletedAt(time.Now()).SetUpdatedAt(time.Now()).Save(ctx)
409+
_, err := tx.Workflow.UpdateOneID(id).SetDeletedAt(time.Now()).SetUpdatedAt(time.Now()).Save(ctx)
410410
if err != nil {
411411
return err
412412
}
413413

414-
// Soft delete project if it has no more workflows
415-
// TODO: in the future, we'll handle this separately through explicit user action
416-
if wfTotal, err := wf.QueryProject().QueryWorkflows().Where(workflow.DeletedAtIsNil()).Count(ctx); err != nil {
417-
return err
418-
} else if wfTotal == 0 {
419-
// soft deleted project if it has no more workflows
420-
if err := tx.Project.UpdateOneID(wf.ProjectID).SetDeletedAt(time.Now()).Exec(ctx); err != nil {
421-
return err
422-
}
423-
}
424414
return nil
425415
})
426416
}

0 commit comments

Comments
 (0)