first commit
This commit is contained in:
28
internal/modules/auth/routes.go
Normal file
28
internal/modules/auth/routes.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user