user

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEmail            = errors.New("email inválido")
	ErrInvalidPassword         = errors.New("senha deve ter pelo menos 8 caracteres")
	ErrInvalidRole             = errors.New("papel inválido")
	ErrDeleteLastAdmin         = errors.New("não é possível remover o último administrador")
	ErrTokenServiceUnavailable = errors.New("serviço de tokens indisponível")
)

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	Email    string
	Password string
	Role     string
}

type InstanceManager

type InstanceManager interface {
	ListByUser(ctx context.Context, userID string, userRole string) ([]model.Instance, error)
	Delete(ctx context.Context, id string) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo storage.UserRepository, tokenService TokenManager, instanceSvc InstanceManager) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, input CreateInput) (model.User, string, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) Exists

func (s *Service) Exists(ctx context.Context, id string) (bool, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (model.User, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]model.User, error)

func (*Service) RotateAPIToken

func (s *Service) RotateAPIToken(ctx context.Context, id string) (string, error)

func (*Service) UpdatePassword

func (s *Service) UpdatePassword(ctx context.Context, id, password string) error

type TokenManager

type TokenManager interface {
	Create(ctx context.Context, userID, name string, expiresAt *time.Time) (model.APIToken, string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL