diff --git a/plugins/identity/identified.go b/plugins/identity/identified.go index c26b806..95c16d9 100644 --- a/plugins/identity/identified.go +++ b/plugins/identity/identified.go @@ -15,7 +15,7 @@ func (identity *Identify) Name() string { } func (identity *Identify) Initialize(db *gorm.DB) (err error) { - err = db.Callback().Create().Before("gorm:create").Register("auto_identified", identity.Grant) + err = db.Callback().Create().Before("gorm:create").Register("rest_auto_identified", identity.Grant) return } diff --git a/plugins/validate/validation.go b/plugins/validate/validation.go index 59d83db..aed6398 100644 --- a/plugins/validate/validation.go +++ b/plugins/validate/validation.go @@ -121,10 +121,10 @@ func (validate *Validate) findRule(name string, rules []*validateRule) *validate func (validate *Validate) Initialize(db *gorm.DB) (err error) { validate.validator = validator.New() - if err = db.Callback().Create().Before("gorm:before_create").Register("model_validate", validate.Validate); err != nil { + if err = db.Callback().Create().Before("gorm:before_create").Register("rest_validate_create", validate.Validate); err != nil { return } - if err = db.Callback().Create().Before("gorm:before_update").Register("model_validate", validate.Validate); err != nil { + if err = db.Callback().Create().Before("gorm:before_update").Register("rest_validate_update", validate.Validate); err != nil { return } if err = validate.validator.RegisterValidationCtx("telephone", validate.telephoneValidate); err != nil {