backend moved to separate directory
backend: deleted the old structure
This commit is contained in:
20
go-backend/internal/validation/setup.go
Normal file
20
go-backend/internal/validation/setup.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package validation
|
||||
|
||||
import (
|
||||
"GoMembership/internal/models"
|
||||
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func SetupValidators() {
|
||||
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
|
||||
// Register custom validators
|
||||
v.RegisterValidation("safe_content", ValidateSafeContent)
|
||||
|
||||
// Register struct-level validations
|
||||
v.RegisterStructValidation(validateUser, models.User{})
|
||||
v.RegisterStructValidation(ValidateSubscription, models.SubscriptionModel{})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user