usecase

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package usecase user managing

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPasswordResetCode = errors.New(`invalid password reset code`)

Functions

This section is empty.

Types

type UserUsecase

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

UserUsecase provides bussiness logic for user access

func NewUserUsecase

func NewUserUsecase(repo user.Repository) *UserUsecase

NewUserUsecase user implementation

func (*UserUsecase) Count

func (a *UserUsecase) Count(ctx context.Context, filter *user.ListFilter) (int64, error)

Count of users by filter

func (*UserUsecase) Delete

func (a *UserUsecase) Delete(ctx context.Context, id uint64) error

Delete delites record by ID

func (*UserUsecase) FetchList

func (a *UserUsecase) FetchList(ctx context.Context, filter *user.ListFilter, order *user.ListOrder, page *repository.Pagination) ([]*model.User, error)

FetchList of users by filter

func (*UserUsecase) Get

func (a *UserUsecase) Get(ctx context.Context, id uint64) (*model.User, error)

Get returns the group by ID if have access

func (*UserUsecase) GetByEmail

func (a *UserUsecase) GetByEmail(ctx context.Context, email string) (*model.User, error)

GetByEmail returns the group by Email if have access

func (*UserUsecase) GetByPassword

func (a *UserUsecase) GetByPassword(ctx context.Context, email, password string) (*model.User, error)

GetByPassword returns user by email + password

func (*UserUsecase) GetByToken

func (a *UserUsecase) GetByToken(ctx context.Context, token string) (*model.User, *model.Account, error)

GetByToken returns user + account by session token

func (*UserUsecase) ResetPassword

func (a *UserUsecase) ResetPassword(ctx context.Context, email string) (*model.UserPasswordReset, *model.User, error)

ResetPassword for the exists user

func (*UserUsecase) SetPassword

func (a *UserUsecase) SetPassword(ctx context.Context, userObj *model.User, password string) error

SetPassword for the exists user

func (*UserUsecase) Store

func (a *UserUsecase) Store(ctx context.Context, userObj *model.User, password string) (uint64, error)

Store new object into database

func (*UserUsecase) Update

func (a *UserUsecase) Update(ctx context.Context, userObj *model.User) error

Update existing object in database

func (*UserUsecase) UpdatePassword

func (a *UserUsecase) UpdatePassword(ctx context.Context, token, email, password string) error

UpdatePassword for the exists user from reset token

Jump to

Keyboard shortcuts

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