feat: customer list
This commit is contained in:
@@ -80,6 +80,7 @@ type User interface {
|
||||
Create(ctx mycontext.Context, userReq *entity.User) (*entity.User, error)
|
||||
CreateWithTx(ctx mycontext.Context, tx *gorm.DB, userReq *entity.User) (*entity.User, error)
|
||||
GetAll(ctx mycontext.Context, search entity.UserSearch) ([]*entity.User, int, error)
|
||||
GetAllCustomer(ctx mycontext.Context, search entity.CustomerSearch) ([]*entity.Customer, int, error)
|
||||
Update(ctx mycontext.Context, id int64, userReq *entity.User) (*entity.User, error)
|
||||
UpdateWithTx(ctx mycontext.Context, tx *gorm.DB, req *entity.User) (*entity.User, error)
|
||||
GetByID(ctx mycontext.Context, id int64) (*entity.User, error)
|
||||
|
||||
@@ -86,6 +86,17 @@ func (s *UserService) GetAll(ctx mycontext.Context, search entity.UserSearch) ([
|
||||
return users.ToUserList(), total, nil
|
||||
}
|
||||
|
||||
func (s *UserService) GetAllCustomer(ctx mycontext.Context, search entity.CustomerSearch) ([]*entity.Customer, int, error) {
|
||||
|
||||
users, total, err := s.repo.GetAllCustomer(ctx, search)
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when get all users", zap.Error(err))
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return users.ToCustomerList(), total, nil
|
||||
}
|
||||
|
||||
func (s *UserService) GetByID(ctx mycontext.Context, id int64) (*entity.User, error) {
|
||||
userDB, err := s.repo.GetUserByID(ctx, id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user