29 lines
913 B
Go
29 lines
913 B
Go
package auth
|
|
|
|
import (
|
|
"cardverse/internal/middleware"
|
|
"cardverse/internal/modules/user"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func RegisterRoutes(rg *gin.RouterGroup, db *gorm.DB) {
|
|
userRepo := user.NewRepository(db)
|
|
authRepo := NewRepository(db)
|
|
service := NewService(userRepo, authRepo)
|
|
handler := NewHandler(service)
|
|
|
|
authGroup := rg.Group("/auth")
|
|
{
|
|
authGroup.POST("/register", handler.Register)
|
|
authGroup.POST("/login", middleware.RateLimiter(1, 3), handler.Login)
|
|
authGroup.POST("/google", middleware.RateLimiter(1, 3), handler.GoogleLogin)
|
|
authGroup.POST("/refresh-token", handler.RefreshToken)
|
|
authGroup.POST("/logout", handler.Logout)
|
|
authGroup.POST("/verify-email", middleware.RateLimiter(1, 3), handler.VerifyEmail)
|
|
authGroup.POST("/forgot-password", middleware.RateLimiter(1, 3), handler.ForgotPassword)
|
|
authGroup.POST("/reset-password", handler.ResetPassword)
|
|
}
|
|
}
|