Add user Roles
This commit is contained in:
+9
-1
@@ -43,14 +43,16 @@ func (a *App) Initialize(cfg *config.Config) error {
|
||||
middlewares := a.initMiddleware(services)
|
||||
healthHandler := handler.NewHealthHandler()
|
||||
fileHandler := handler.NewFileHandler(services.fileService)
|
||||
rbacHandler := handler.NewRBACHandler(services.rbacService)
|
||||
|
||||
a.router = router.NewRouter(
|
||||
cfg,
|
||||
handler.NewAuthHandler(services.authService),
|
||||
middlewares.authMiddleware,
|
||||
healthHandler,
|
||||
handler.NewUserHandler(services.userService, &validator.UserValidatorImpl{}),
|
||||
handler.NewUserHandler(services.userService, validator.NewUserValidator()),
|
||||
fileHandler,
|
||||
rbacHandler,
|
||||
)
|
||||
|
||||
return nil
|
||||
@@ -99,6 +101,7 @@ type repositories struct {
|
||||
userRepo *repository.UserRepositoryImpl
|
||||
userProfileRepo *repository.UserProfileRepository
|
||||
titleRepo *repository.TitleRepository
|
||||
rbacRepo *repository.RBACRepository
|
||||
}
|
||||
|
||||
func (a *App) initRepositories() *repositories {
|
||||
@@ -106,6 +109,7 @@ func (a *App) initRepositories() *repositories {
|
||||
userRepo: repository.NewUserRepository(a.db),
|
||||
userProfileRepo: repository.NewUserProfileRepository(a.db),
|
||||
titleRepo: repository.NewTitleRepository(a.db),
|
||||
rbacRepo: repository.NewRBACRepository(a.db),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +127,7 @@ type services struct {
|
||||
userService *service.UserServiceImpl
|
||||
authService *service.AuthServiceImpl
|
||||
fileService *service.FileServiceImpl
|
||||
rbacService *service.RBACServiceImpl
|
||||
}
|
||||
|
||||
func (a *App) initServices(processors *processors, repos *repositories, cfg *config.Config) *services {
|
||||
@@ -137,10 +142,13 @@ func (a *App) initServices(processors *processors, repos *repositories, cfg *con
|
||||
s3Client := client.NewFileClient(fileCfg)
|
||||
fileSvc := service.NewFileService(s3Client, processors.userProcessor, "profile", "documents")
|
||||
|
||||
rbacSvc := service.NewRBACService(repos.rbacRepo)
|
||||
|
||||
return &services{
|
||||
userService: userSvc,
|
||||
authService: authService,
|
||||
fileService: fileSvc,
|
||||
rbacService: rbacSvc,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user