032ce66865
modified: main_dc/yalarba/api_es/internal/handler/all_handlers.go modified: main_dc/yalarba/api_es/internal/handler/user_handler.go new file: main_dc/yalarba/api_es/internal/router/router.go add rounter, logger router
33 lines
580 B
Go
33 lines
580 B
Go
package handler
|
|
|
|
import (
|
|
"api_es/internal/config"
|
|
"api_es/internal/repository"
|
|
"api_es/internal/service"
|
|
"api_es/internal/utils"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type AllHandler struct {
|
|
userHandler *UserHandler
|
|
}
|
|
|
|
func NewAllHandler(db *gorm.DB, cfg *config.Config) *AllHandler {
|
|
|
|
userRepo := repository.NewUserRepository(db)
|
|
|
|
userService := service.NewUserService(userRepo, utils.NewJWTUtil(cfg.JWTSecret))
|
|
|
|
userHandler := NewUserHandler(userService)
|
|
|
|
return &AllHandler{
|
|
userHandler: userHandler,
|
|
}
|
|
|
|
}
|
|
|
|
|
|
func (h *AllHandler) UserHandler() *UserHandler {
|
|
return h.userHandler
|
|
} |