MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / SoftDelete

Method SoftDelete

app/controlplane/pkg/data/workflow.go:482–500  ·  view source on GitHub ↗

Soft delete workflow, attachments and related projects (if applicable)

(ctx context.Context, id uuid.UUID)

Source from the content-addressed store, hash-verified

480
481// Soft delete workflow, attachments and related projects (if applicable)
482func (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
502func entWFToBizWF(ctx context.Context, w *ent.Workflow) (*biz.Workflow, error) {
503 wf := &biz.Workflow{Name: w.Name, ID: w.ID,

Callers

nothing calls this directly

Implementers 1

WorkflowRepoapp/controlplane/pkg/data/workflow.go

Calls 11

StartFunction · 0.92
HasWorkflowWithFunction · 0.92
IDFunction · 0.92
WithTxFunction · 0.85
ExecMethod · 0.65
UpdateMethod · 0.65
SaveMethod · 0.65
SetDeletedAtMethod · 0.45
WhereMethod · 0.45
SetUpdatedAtMethod · 0.45
UpdateOneIDMethod · 0.45

Tested by

no test coverage detected