(ctx context.Context, id uuid.UUID)
| 461 | } |
| 462 | |
| 463 | func (r *WorkflowRepo) FindByID(ctx context.Context, id uuid.UUID) (*biz.Workflow, error) { |
| 464 | ctx, span := otelx.Start(ctx, workflowRepoTracer, "WorkflowRepo.FindByID") |
| 465 | defer span.End() |
| 466 | |
| 467 | workflow, err := r.data.DB.Workflow.Query(). |
| 468 | Where(workflow.DeletedAtIsNil(), workflow.ID(id)). |
| 469 | WithContract().WithOrganization().WithLatestWorkflowRun().WithProject(). |
| 470 | Only(ctx) |
| 471 | if err != nil { |
| 472 | if ent.IsNotFound(err) { |
| 473 | return nil, biz.NewErrNotFound("workflow") |
| 474 | } |
| 475 | return nil, err |
| 476 | } |
| 477 | |
| 478 | return entWFToBizWF(ctx, workflow) |
| 479 | } |
| 480 | |
| 481 | // Soft delete workflow, attachments and related projects (if applicable) |
| 482 | func (r *WorkflowRepo) SoftDelete(ctx context.Context, id uuid.UUID) (err error) { |
no test coverage detected