Skip to main content

Function: CreatedBy()

CreatedBy(columnName?): PropertyDecorator

Defined in: src/decorators/CreatedBy.ts:16

Property decorator indicating that this field is auto-populated with the current user / author identifier on INSERT.

Reads value from context.currentUser if set.

Parameters​

ParameterTypeDescription
columnName?stringOptional custom database column name.

Returns​

PropertyDecorator

Usecase​

Audit logging and tracking record ownership (e.g. which user created this resource).

Example​

@CreatedBy()
createdBy?: string;