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

Method IsPublic

app/controlplane/pkg/data/casmapping.go:203–224  ·  view source on GitHub ↗
(ctx context.Context, client *ent.Client, runID uuid.UUID)

Source from the content-addressed store, hash-verified

201}
202
203func (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
226func entCASMappingToBiz(input *ent.CASMapping, public bool) (*biz.CASMapping, error) {
227 if input == nil {

Callers 1

findByIDMethod · 0.95

Implementers 3

CASMappingRepoapp/controlplane/pkg/biz/mocks/CASMapp
CASMappingRepo_Expecterapp/controlplane/pkg/biz/mocks/CASMapp
CASMappingRepoapp/controlplane/pkg/data/casmapping.g

Calls 7

StartFunction · 0.92
IDFunction · 0.92
IDFunction · 0.92
FirstMethod · 0.45
SelectMethod · 0.45
WhereMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected