From 4fd3d58ea0a12a1a3ebd474111e7bd022a0b3d9f Mon Sep 17 00:00:00 2001 From: fancl Date: Thu, 12 Dec 2024 17:02:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/identity/identified.go | 2 +- plugins/validate/validation.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 {