Skip to content

postgrelize / BeforeCreate

Variable: BeforeCreate ​

const BeforeCreate: ModelStaticMethodDecorator

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

Registers the decorated static method as a beforeCreate hook of the model (like Model.beforeCreate). 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 {
  @BeforeCreate
  static async onBeforeCreate(user: User, options: unknown) {}
}

Released under the MIT License.