mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-05-19 00:29:24 -05:00
5d87f380ef
* change api extension spec to register custom populators * fix: support only bearer auth * fix: correct authn logic * fix: indexes on workflow runs, events * feat: managed worker pools * chore: lint fix * hide workers view when not enabled * support internal api tokens, minor improvements * fix: actually write internal * fix breaking changes * don't allow revoking internal tokens * fix: linting and remove metrics view * fix: token * address review and add feat flags
37 lines
917 B
Go
37 lines
917 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/hatchet-dev/hatchet/pkg/repository/prisma/db"
|
|
"github.com/hatchet-dev/hatchet/pkg/repository/prisma/dbsqlc"
|
|
)
|
|
|
|
type CreateAPITokenOpts struct {
|
|
// The id of the token
|
|
ID string `validate:"required,uuid"`
|
|
|
|
// When the token expires
|
|
ExpiresAt time.Time
|
|
|
|
// (optional) A tenant ID for this API token
|
|
TenantId *string `validate:"omitempty,uuid"`
|
|
|
|
// (optional) A name for this API token
|
|
Name *string `validate:"omitempty,max=255"`
|
|
|
|
Internal bool
|
|
}
|
|
|
|
type APITokenRepository interface {
|
|
GetAPITokenById(id string) (*db.APITokenModel, error)
|
|
RevokeAPIToken(id string) error
|
|
ListAPITokensByTenant(tenantId string) ([]db.APITokenModel, error)
|
|
}
|
|
|
|
type EngineTokenRepository interface {
|
|
CreateAPIToken(ctx context.Context, opts *CreateAPITokenOpts) (*dbsqlc.APIToken, error)
|
|
GetAPITokenById(ctx context.Context, id string) (*dbsqlc.APIToken, error)
|
|
}
|