Skip to content

Commit

Permalink
update userAuth to user
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukmanern committed Nov 15, 2023
1 parent 8d1bdb7 commit 867617a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions application/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (

// Create a new fiber instance with custom config
router = fiber.New(fiber.Config{
AppName: "Gost Project",
// Override default error handler
ErrorHandler: func(ctx *fiber.Ctx, err error) error {
// Status code defaults to 500
Expand Down
10 changes: 5 additions & 5 deletions controller/user/user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ type UserControllerImpl struct {
}

var (
userAuthController *UserControllerImpl
userAuthControllerOnce sync.Once
userController *UserControllerImpl
userControllerOnce sync.Once
)

func NewUserController(service service.UserService) UserController {
userAuthControllerOnce.Do(func() {
userAuthController = &UserControllerImpl{
userControllerOnce.Do(func() {
userController = &UserControllerImpl{
service: service,
}
})

return userAuthController
return userController
}

func (ctr *UserControllerImpl) Register(c *fiber.Ctx) error {
Expand Down
10 changes: 5 additions & 5 deletions service/user/user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ type UserServiceImpl struct {
}

var (
userAuthService *UserServiceImpl
userAuthServiceOnce sync.Once
userService *UserServiceImpl
userServiceOnce sync.Once
)

func NewUserService(roleService roleService.RoleService) UserService {
userAuthServiceOnce.Do(func() {
userAuthService = &UserServiceImpl{
userServiceOnce.Do(func() {
userService = &UserServiceImpl{
roleService: roleService,
repository: repository.NewUserRepository(),
emailService: emailService.NewEmailService(),
Expand All @@ -95,7 +95,7 @@ func NewUserService(roleService roleService.RoleService) UserService {
}
})

return userAuthService
return userService
}

func (svc *UserServiceImpl) Register(ctx context.Context, user model.UserRegister) (id int, err error) {
Expand Down

0 comments on commit 867617a

Please sign in to comment.