diff --git a/auth/account.go b/auth/account.go index ac4cc4c..6c68ec5 100644 --- a/auth/account.go +++ b/auth/account.go @@ -33,10 +33,7 @@ func (a *Account) BeforeInsert(db orm.DB) error { a.CreatedAt = now a.UpdatedAt = now } - if err := a.Validate(); err != nil { - return err - } - return nil + return a.Validate() } // BeforeUpdate hook executed before database update operation. diff --git a/models/profile.go b/models/profile.go index 9d4dc22..115b6ef 100644 --- a/models/profile.go +++ b/models/profile.go @@ -25,11 +25,8 @@ func (p *Profile) BeforeInsert(db orm.DB) error { // BeforeUpdate hook executed before database update operation. func (p *Profile) BeforeUpdate(db orm.DB) error { - if err := p.Validate(); err != nil { - return err - } p.UpdatedAt = time.Now() - return nil + return p.Validate() } // Validate validates Profile struct and returns validation errors.