added mail functionality

This commit is contained in:
$(pass /github/name)
2024-07-03 12:35:41 +02:00
parent 6d34d99835
commit 96f008d67e
10 changed files with 132 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
package server
import (
"GoMembership/internal/config"
"GoMembership/internal/controllers"
"GoMembership/internal/database"
"GoMembership/internal/middlewares"
@@ -14,12 +15,15 @@ import (
)
func Run() {
db := database.Connect()
cfg := config.LoadConfig()
db := database.Connect(cfg.DB)
defer db.Close()
emailService := services.NewEmailService(cfg.SMTP.Host, cfg.SMTP.Port, cfg.SMTP.User, cfg.SMTP.Password, cfg.SMTP.AdminEmail)
userRepo := repositories.NewUserRepository(db)
userService := services.NewUserService(userRepo)
userController := controllers.NewUserController(userService)
userController := controllers.NewUserController(userService, emailService)
router := mux.NewRouter()
// router.Handle("/csrf-token", middlewares.GenerateCSRFTokenHandler()).Methods("GET")