diff --git a/internal/apptoken/query.go b/internal/apptoken/query.go index c922530c3b..24e7b15333 100644 --- a/internal/apptoken/query.go +++ b/internal/apptoken/query.go @@ -380,22 +380,6 @@ left join iam_scope_project app_token_org.public_id; ` - // TODO: This will be properly implemented with the Create method - // getAppTokenByIdQuery retrieves an AppToken by its public ID - getAppTokenByIdQuery = ` - select public_id, scope_id - from app_token_global - where public_id = $1 - union all - select public_id, scope_id - from app_token_org - where public_id = $1 - union all - select public_id, scope_id - from app_token_project - where public_id = $1 - ` - // estimateCountAppTokens estimates the total number of app tokens in the three app token tables estimateCountAppTokens = ` select sum(reltuples::bigint) as estimate diff --git a/internal/apptoken/repository.go b/internal/apptoken/repository.go index ce9aea1672..cf28004ebc 100644 --- a/internal/apptoken/repository.go +++ b/internal/apptoken/repository.go @@ -420,35 +420,6 @@ func createAppTokenProject(ctx context.Context, token *AppToken) (*appTokenProje return tokenToCreate, projectInserts, nil } -// TODO: Implement additional fields in AppToken and complete this method -// getAppTokenById retrieves an AppToken by its public ID -func (r *Repository) getAppTokenById(ctx context.Context, id string) (*AppToken, error) { - const op = "apptoken.(Repository).getAppTokenById" - if id == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "missing id") - } - - rows, err := r.reader.Query(ctx, getAppTokenByIdQuery, []any{id}) - if err != nil { - return nil, errors.Wrap(ctx, err, op) - } - defer rows.Close() - - var at AppToken - if rows.Next() { - if err := rows.Scan(&at.PublicId, &at.ScopeId); err != nil { - return nil, errors.Wrap(ctx, err, op) - } - } - if err := rows.Err(); err != nil { - return nil, errors.Wrap(ctx, err, op) - } - if at.PublicId == "" { - return nil, errors.New(ctx, errors.NotFound, op, "app token not found") - } - return &at, nil -} - // processPermissionGrants validates grants and creates grant objects for insertion func processPermissionGrants(ctx context.Context, permId string, grants []string) ([]*appTokenPermissionGrant, error) { const op = "apptoken.processPermissionGrants"