Soft delete workflow, attachments and related projects (if applicable)
(ctx context.Context, id uuid.UUID)
| 480 | |
| 481 | // Soft delete workflow, attachments and related projects (if applicable) |
| 482 | func (r *WorkflowRepo) SoftDelete(ctx context.Context, id uuid.UUID) (err error) { |
| 483 | ctx, span := otelx.Start(ctx, workflowRepoTracer, "WorkflowRepo.SoftDelete") |
| 484 | defer span.End() |
| 485 | |
| 486 | return WithTx(ctx, r.data.DB, func(tx *ent.Tx) error { |
| 487 | // soft-delete attachments associated with this workflow |
| 488 | if err := tx.IntegrationAttachment.Update().Where(integrationattachment.HasWorkflowWith(workflow.ID(id))).SetDeletedAt(time.Now()).Exec(ctx); err != nil { |
| 489 | return err |
| 490 | } |
| 491 | |
| 492 | // Soft delete workflow |
| 493 | _, err := tx.Workflow.UpdateOneID(id).SetDeletedAt(time.Now()).SetUpdatedAt(time.Now()).Save(ctx) |
| 494 | if err != nil { |
| 495 | return err |
| 496 | } |
| 497 | |
| 498 | return nil |
| 499 | }) |
| 500 | } |
| 501 | |
| 502 | func entWFToBizWF(ctx context.Context, w *ent.Workflow) (*biz.Workflow, error) { |
| 503 | wf := &biz.Workflow{Name: w.Name, ID: w.ID, |
nothing calls this directly
no test coverage detected