(ctx context.Context, opts *biz.IntegrationCreateOpts)
| 44 | } |
| 45 | |
| 46 | func (r *IntegrationRepo) Create(ctx context.Context, opts *biz.IntegrationCreateOpts) (*biz.Integration, error) { |
| 47 | ctx, span := otelx.Start(ctx, integrationRepoTracer, "IntegrationRepo.Create") |
| 48 | defer span.End() |
| 49 | |
| 50 | integration, err := r.data.DB.Integration.Create(). |
| 51 | SetName(opts.Name). |
| 52 | SetOrganizationID(opts.OrgID). |
| 53 | SetKind(opts.Kind). |
| 54 | SetDescription(opts.Description). |
| 55 | SetSecretName(opts.SecretName). |
| 56 | SetConfiguration(opts.Config). |
| 57 | Save(ctx) |
| 58 | |
| 59 | if err != nil { |
| 60 | if ent.IsConstraintError(err) { |
| 61 | return nil, biz.NewErrAlreadyExists(err) |
| 62 | } |
| 63 | |
| 64 | return nil, fmt.Errorf("failed to create registration: %w", err) |
| 65 | } |
| 66 | |
| 67 | return entIntegrationToBiz(integration), nil |
| 68 | } |
| 69 | |
| 70 | func (r *IntegrationRepo) List(ctx context.Context, orgID uuid.UUID) ([]*biz.Integration, error) { |
| 71 | ctx, span := otelx.Start(ctx, integrationRepoTracer, "IntegrationRepo.List") |
nothing calls this directly
no test coverage detected