mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
- Add new dependencies: `github.com/joho/godotenv`, `github.com/stretchr/testify`, and `gopkg.in/natefinch/lumberjack.v2` - Remove indirect dependency on `github.com/joho/godotenv` - Refactor JobRunDetails template to separate content rendering for improved testing - Enhance error message display in JobRunDetails template - Introduce new test files for JWT and password functionalities - Add comprehensive tests for database operations and error handling
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package web
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/starfleetcptn/gomft/internal/config"
|
|
"github.com/starfleetcptn/gomft/internal/db"
|
|
"github.com/starfleetcptn/gomft/internal/email"
|
|
"github.com/starfleetcptn/gomft/internal/scheduler"
|
|
"github.com/starfleetcptn/gomft/internal/web/handlers"
|
|
)
|
|
|
|
// Handler is a wrapper around the handlers package
|
|
type Handler struct {
|
|
handlers *handlers.Handlers
|
|
}
|
|
|
|
// NewHandler creates a new Handler instance that delegates to the handlers package
|
|
func NewHandler(database *db.DB, scheduler *scheduler.Scheduler, jwtSecret string, dbPath string, backupDir string, cfg *config.Config) (*Handler, error) {
|
|
// Create email service instance
|
|
emailService := email.NewService(cfg)
|
|
|
|
// Create handlers instance
|
|
handlersInstance := handlers.NewHandlers(database, scheduler, jwtSecret, dbPath, backupDir, "./logs", emailService)
|
|
|
|
return &Handler{
|
|
handlers: handlersInstance,
|
|
}, nil
|
|
}
|
|
|
|
// InitializeRoutes delegates route registration to the handlers package
|
|
func (h *Handler) InitializeRoutes(router *gin.Engine) {
|
|
// Register all routes through the handlers package
|
|
h.handlers.RegisterRoutes(router)
|
|
}
|