Skip to content

postgrelize / BeforeValidate

Variable: BeforeValidate ​

const BeforeValidate: ModelStaticMethodDecorator

Defined in: src/decorators/hook-decorators.ts:17

Registers the decorated static method as a beforeValidate hook of the model (like Model.beforeValidate). The method receives the hook arguments; static methods only. Registered when sequelize.addModels applies the class. Accepts the TC39 and the legacy experimentalDecorators call signature.

Example ​

ts
class User extends Model {
  @BeforeValidate
  static async onBeforeValidate(user: User, options: unknown) {}
}

Released under the MIT License.