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

Method Delete

app/controlplane/pkg/biz/workflow.go:476–511  ·  view source on GitHub ↗

Delete soft-deletes the entry

(ctx context.Context, orgID, workflowID string)

Source from the content-addressed store, hash-verified

474
475// Delete soft-deletes the entry
476func (uc *WorkflowUseCase) Delete(ctx context.Context, orgID, workflowID string) error {
477 ctx, span := otelx.Start(ctx, workflowTracer, "WorkflowUseCase.Delete")
478 defer span.End()
479
480 orgUUID, err := uuid.Parse(orgID)
481 if err != nil {
482 return NewErrInvalidUUID(err)
483 }
484
485 workflowUUID, err := uuid.Parse(workflowID)
486 if err != nil {
487 return NewErrInvalidUUID(err)
488 }
489
490 // Check that the workflow to delete belongs to the provided organization
491 wf, err := uc.wfRepo.GetOrgScoped(ctx, orgUUID, workflowUUID)
492 if err != nil {
493 return fmt.Errorf("failed to get workflow: %w", err)
494 } else if wf == nil {
495 return NewErrNotFound("organization")
496 }
497
498 if err := uc.wfRepo.SoftDelete(ctx, workflowUUID); err != nil {
499 return fmt.Errorf("failed to soft delete workflow: %w", err)
500 }
501
502 uc.auditorUC.Dispatch(ctx, &events.WorkflowDeleted{
503 WorkflowBase: &events.WorkflowBase{
504 WorkflowID: &workflowUUID,
505 WorkflowName: wf.Name,
506 ProjectName: wf.Project,
507 },
508 }, &orgUUID)
509
510 return nil
511}

Callers

nothing calls this directly

Calls 7

StartFunction · 0.92
NewErrInvalidUUIDFunction · 0.85
ParseMethod · 0.80
NewErrNotFoundFunction · 0.70
GetOrgScopedMethod · 0.65
SoftDeleteMethod · 0.65
DispatchMethod · 0.45

Tested by

no test coverage detected