users

package
v0.0.0-...-946fd12 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func NewAuthSrv

func NewAuthSrv(
	usersRepository UsersRepository, redis *redis.Client, accessToken auth.TokenGenerator,
	refreshToken auth.TokenGenerator, logger *zap.SugaredLogger,
) Auth

func (Auth) Authenticate

func (s Auth) Authenticate(ctx context.Context, email, pwd, deviceID string) (
	auth.AccessToken, auth.RefreshToken, error,
)

func (Auth) Refresh

func (s Auth) Refresh(ctx context.Context, userID int, tokenUUID, deviceID string) (auth.AccessToken, auth.RefreshToken, error)

func (Auth) SignOut

func (s Auth) SignOut(ctx context.Context, userID int, deviceID string) error

func (Auth) SignOutAll

func (s Auth) SignOutAll(ctx context.Context, userID int) error

func (Auth) Validate

func (s Auth) Validate(ctx context.Context, tokenStr string) (auth.Token, error)

type Emailer

type Emailer interface {
	Send(subject, receiver string, body string) error
}

type Password

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

func NewPasswordSrv

func NewPasswordSrv(
	signRepository UsersRepository,
	tokenRepository TokensRepository,
	emailer Emailer,
	pwdResetExpirationHours int,
	pwdResetUrl string,
	logger *zap.SugaredLogger,
) Password

func (Password) ResetPassword

func (s Password) ResetPassword(ctx context.Context, email string) error

func (Password) SetNewPassword

func (s Password) SetNewPassword(ctx context.Context, token, newPwd string) error

type Profile

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

func NewProfileSrv

func NewProfileSrv(
	repo UsersRepository,
	proprRepo PropertyRepository,
	publisher UsersPublisher,
	logger *zap.SugaredLogger,
) Profile

func (Profile) Activate

func (s Profile) Activate(ctx context.Context, userID int) error

func (Profile) Deactivate

func (s Profile) Deactivate(ctx context.Context, userID int) error

func (Profile) GetProfile

func (s Profile) GetProfile(ctx context.Context, userID int) (*domain.User, error)

func (Profile) UpdateProfile

func (s Profile) UpdateProfile(ctx context.Context, user *domain.User) error

type PropertyRepository

type PropertyRepository interface {
	UpdateActivity(ctx context.Context, userID int, active bool) error
}

type SignUp

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

func NewSignupSrv

func NewSignupSrv(
	signRepository UsersRepository,
	publisher UsersPublisher,
	registrationExpirationHours int,
	logger *zap.SugaredLogger,
) SignUp

func (SignUp) SignUp

func (s SignUp) SignUp(ctx context.Context, user domain.User) error

type TokensRepository

type TokensRepository interface {
	Create(ctx context.Context, tokenAction *domain.UserTokenAction) error
	Update(ctx context.Context, tokenAction *domain.UserTokenAction) error
	GetByToken(ctx context.Context, token string) (*domain.UserTokenAction, error)
}

type UsersPublisher

type UsersPublisher interface {
	UserDeactivated(email string)
	SignUp(receiver string, activationToken string)
}

type UsersRepository

type UsersRepository interface {
	GetByEmail(ctx context.Context, email string) (*domain.User, error)
	Get(ctx context.Context, userID int) (*domain.User, error)
	Update(ctx context.Context, user *domain.User) error
	UpdateActivity(ctx context.Context, userID int, active bool) error
	Create(ctx context.Context, u domain.User, t domain.UserTokenAction) error
	EmailExists(ctx context.Context, email string) (bool, error)
	SetNewPwd(ctx context.Context, user *domain.User) error
}

Jump to

Keyboard shortcuts

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