(ctx context.Context, id uuid.UUID)
| 71 | } |
| 72 | |
| 73 | func (r *APITokenRepo) FindByID(ctx context.Context, id uuid.UUID) (*biz.APIToken, error) { |
| 74 | ctx, span := otelx.Start(ctx, apiTokenRepoTracer, "APITokenRepo.FindByID") |
| 75 | defer span.End() |
| 76 | |
| 77 | token, err := r.data.DB.APIToken.Query().Where(apitoken.ID(id)).WithOrganization().WithProject().WithWorkflow().Only(ctx) |
| 78 | if err != nil && !ent.IsNotFound(err) { |
| 79 | return nil, fmt.Errorf("getting APIToken: %w", err) |
| 80 | } else if token == nil { |
| 81 | return nil, nil |
| 82 | } |
| 83 | |
| 84 | return entAPITokenToBiz(token), nil |
| 85 | } |
| 86 | |
| 87 | func (r *APITokenRepo) FindByIDInOrg(ctx context.Context, orgID uuid.UUID, id uuid.UUID) (*biz.APIToken, error) { |
| 88 | ctx, span := otelx.Start(ctx, apiTokenRepoTracer, "APITokenRepo.FindByIDInOrg") |
no test coverage detected