(ctx context.Context, client *ent.Client, runID uuid.UUID)
| 201 | } |
| 202 | |
| 203 | func (r *CASMappingRepo) IsPublic(ctx context.Context, client *ent.Client, runID uuid.UUID) (bool, error) { |
| 204 | ctx, span := otelx.Start(ctx, casMappingRepoTracer, "CASMappingRepo.IsPublic") |
| 205 | defer span.End() |
| 206 | |
| 207 | // If the workflow run id is not set, the mapping is not public |
| 208 | if runID == uuid.Nil { |
| 209 | return false, nil |
| 210 | } |
| 211 | |
| 212 | // Check if the workflow is public |
| 213 | wr, err := client.WorkflowRun.Query().Where(workflowrun.ID(runID)).Select(workflowrun.FieldWorkflowID).First(ctx) |
| 214 | if err != nil { |
| 215 | return false, fmt.Errorf("failed to get workflow run: %w", err) |
| 216 | } |
| 217 | |
| 218 | workflow, err := client.Workflow.Query().Where(workflow.ID(wr.WorkflowID)).Select(workflow.FieldPublic).First(ctx) |
| 219 | if err != nil { |
| 220 | return false, fmt.Errorf("failed to get workflow: %w", err) |
| 221 | } |
| 222 | |
| 223 | return workflow.Public, nil |
| 224 | } |
| 225 | |
| 226 | func entCASMappingToBiz(input *ent.CASMapping, public bool) (*biz.CASMapping, error) { |
| 227 | if input == nil { |
no test coverage detected