Skip to main content

Function: AfterInsert()

AfterInsert(): MethodDecorator

Defined in: src/decorators/LifecycleHooks.ts:55

Method decorator marking a method to run immediately after this entity is inserted and its ID is assigned.

Returns​

MethodDecorator

Usecase​

Publish events, trigger welcome notifications, or log audit trails.

Example​

@AfterInsert()
onCreated() {
console.log(`User created with id: ${this.id}`);
}