Documentation ¶
Index ¶
- func NewErrInvalidEmail() shared.AppError
- func NewErrInvalidPassword() shared.AppError
- func NewErrInvalidUsername() shared.AppError
- func NewPasswordValidator(passwordPolicy *shared.FeatureConfig) shared.Validator
- type CreateDTO
- type CreateUserService
- type DiProvider
- type Facade
- type FindQuery
- type FindService
- type ListParams
- type ListUserDTO
- type PasswordService
- type PasswordServiceImpl
- type PasswordStrengthValidator
- type Repositories
- type Repository
- type SecretModel
- type SecretQuery
- type SecretsRepository
- type Services
- type UpdateDTO
- type UpdatePasswordDTO
- type User
- type UserDTO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewErrInvalidEmail ¶
func NewErrInvalidPassword ¶
func NewErrInvalidUsername ¶
func NewPasswordValidator ¶
func NewPasswordValidator(passwordPolicy *shared.FeatureConfig) shared.Validator
Types ¶
type CreateDTO ¶
type CreateUserService ¶
func NewCreateUserService ¶
func NewCreateUserService(userRepo Repository) CreateUserService
type DiProvider ¶
type DiProvider struct { Repos Repositories Services Services Facade Facade }
func NewDiProvider ¶
func NewDiProvider(db shared.DBConnection, features *shared.FeaturesConfig) DiProvider
type Facade ¶
type Facade interface { Create(ctx context.Context, newUser *CreateDTO) (*User, error) Update(ctx context.Context, user *User) (*User, error) Delete(ctx context.Context, userId uuid.UUID) error UpdatePassword(ctx context.Context, userId uuid.UUID, password *UpdatePasswordDTO) error List(ctx context.Context, params ListParams) ([]User, error) Get(ctx context.Context, userId uuid.UUID) (*User, error) GetByUsername(ctx context.Context, userId string) (*User, error) GetByAnyId(ctx context.Context, sid string) (*User, error) }
func NewUsersFacade ¶
func NewUsersFacade(users Repository, secrets SecretsRepository, services Services, features *shared.FeaturesConfig) Facade
type FindService ¶
type FindService interface { Find(ctx context.Context, params FindQuery) ([]User, error) FindOne(ctx context.Context, params FindQuery) (*User, error) }
func NewFindUsersService ¶
func NewFindUsersService(usersRepo Repository) FindService
type ListParams ¶
type ListUserDTO ¶
type ListUserDTO struct { ID uuid.UUID `json:"id" yaml:"id"` Username string `json:"username" yaml:"state"` Email string `json:"email" yaml:"email"` }
func ConvertModelsToList ¶
func ConvertModelsToList(list []User) []ListUserDTO
type PasswordService ¶
type PasswordService interface { CheckPassword(ctx context.Context, user *User, provided string) (bool, error) SetPassword(ctx context.Context, user *User, provided string) error }
func NewPasswordService ¶
func NewPasswordService(usersRepo Repository) PasswordService
type PasswordServiceImpl ¶
type PasswordServiceImpl struct {
// contains filtered or unexported fields
}
func (*PasswordServiceImpl) CheckPassword ¶
func (*PasswordServiceImpl) SetPassword ¶
type PasswordStrengthValidator ¶
type PasswordStrengthValidator struct {
// contains filtered or unexported fields
}
func (*PasswordStrengthValidator) FieldName ¶
func (v *PasswordStrengthValidator) FieldName() string
func (*PasswordStrengthValidator) Validate ¶
func (v *PasswordStrengthValidator) Validate(data interface{}) shared.ValidationResult
type Repositories ¶
type Repositories struct { Users Repository Secrets SecretsRepository }
type Repository ¶
type Repository interface { Create(ctx context.Context, user *User) error Update(ctx context.Context, user *User) error Delete(ctx context.Context, user *User) error Query(ctx context.Context, query FindQuery) ([]User, error) QueryOne(ctx context.Context, query FindQuery) (*User, error) }
func NewUsersRepositoryDB ¶
func NewUsersRepositoryDB(db *gorm.DB) Repository
type SecretModel ¶
type SecretModel struct { ID uuid.UUID `gorm:"type:uuid;primary_key;"` UserID uuid.UUID `gorm:"type:varchar"` Value string `gorm:"type:varchar"` Name string `gorm:"type:varchar"` CreatedAt time.Time `gorm:"type:timestamp"` UpdatedAt time.Time `gorm:"type:timestamp"` ExpiresAt *time.Time `gorm:"type:timestamp"` }
func (SecretModel) IsExpired ¶
func (s SecretModel) IsExpired() bool
func (SecretModel) TableName ¶
func (SecretModel) TableName() string
type SecretQuery ¶
type SecretsRepository ¶
type SecretsRepository interface { Create(ctx context.Context, secret *SecretModel) error Update(ctx context.Context, secret *SecretModel) error Delete(ctx context.Context, secret *SecretModel) error Query(ctx context.Context, query SecretQuery) ([]SecretModel, error) QueryOne(ctx context.Context, query SecretQuery) (*SecretModel, error) }
func NewSecretsRepositoryDB ¶
func NewSecretsRepositoryDB(DB *gorm.DB) SecretsRepository
type Services ¶
type Services struct { Find FindService Password PasswordService }
type UpdateDTO ¶
type UpdatePasswordDTO ¶
type User ¶
type User struct { ID uuid.UUID `gorm:"type:uuid;primary_key;"` CreatedAt time.Time `gorm:"type:timestamp"` UpdatedAt time.Time `gorm:"type:timestamp"` DeletedAt *time.Time `gorm:"type:timestamp"` Username string Password string Name string Email string State string UserType string `gorm:"column:user_type"` }
func (*User) CheckPassword ¶
func (*User) SetPassword ¶
type UserDTO ¶
type UserDTO struct { ID uuid.UUID `json:"id" yaml:"id"` Username string `json:"username" yaml:"username"` Name string `json:"name" yaml:"name"` Email string `json:"email" yaml:"email"` State string `json:"state" yaml:"state"` CreatedAt time.Time `json:"created_at" yaml:"created_at"` UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"` }
func ConvertModelToDTO ¶
Click to show internal directories.
Click to hide internal directories.