GetOrgScoped Gets a workflow making sure it belongs to a given org
(ctx context.Context, orgID, workflowID uuid.UUID)
| 409 | |
| 410 | // GetOrgScoped Gets a workflow making sure it belongs to a given org |
| 411 | func (r *WorkflowRepo) GetOrgScoped(ctx context.Context, orgID, workflowID uuid.UUID) (*biz.Workflow, error) { |
| 412 | ctx, span := otelx.Start(ctx, workflowRepoTracer, "WorkflowRepo.GetOrgScoped") |
| 413 | defer span.End() |
| 414 | |
| 415 | workflow, err := orgScopedQuery(r.data.DB, orgID). |
| 416 | QueryWorkflows(). |
| 417 | Where(workflow.ID(workflowID), workflow.DeletedAtIsNil()). |
| 418 | WithContract().WithOrganization().WithLatestWorkflowRun().WithProject(). |
| 419 | Only(ctx) |
| 420 | |
| 421 | if err != nil { |
| 422 | if ent.IsNotFound(err) { |
| 423 | return nil, biz.NewErrNotFound("workflow") |
| 424 | } |
| 425 | return nil, err |
| 426 | } |
| 427 | |
| 428 | return entWFToBizWF(ctx, workflow) |
| 429 | } |
| 430 | |
| 431 | // GetOrgScopedByProjectAndName Gets a workflow by name making sure it belongs to a given org |
| 432 | func (r *WorkflowRepo) GetOrgScopedByProjectAndName(ctx context.Context, orgID uuid.UUID, projectName, workflowName string) (*biz.Workflow, error) { |
nothing calls this directly
no test coverage detected