NestJS Typeorm Subscriber afterUpdate event not returning updated columns

415 Views Asked by At

I have a Typeorm subscriber which listens to all entity actions. For afterUpdate, the event has these properties.

export interface UpdateEvent<Entity> {
    /**
     * Connection used in the event.
     */
    connection: DataSource;
    /**
     * QueryRunner used in the event transaction.
     * All database operations in the subscribed event listener should be performed using this query runner instance.
     */
    queryRunner: QueryRunner;
    /**
     * EntityManager used in the event transaction.
     * All database operations in the subscribed event listener should be performed using this entity manager instance.
     */
    manager: EntityManager;
    /**
     * Updating entity.
     */
    entity: ObjectLiteral | undefined;
    /**
     * Metadata of the entity.
     */
    metadata: EntityMetadata;
    /**
     * Updating entity in the database.
     */
    databaseEntity: Entity;
    /**
     * List of updated columns. In query builder has no affected
     */
    updatedColumns: ColumnMetadata[];
    /**
     * List of updated relations. In query builder has no affected
     */
    updatedRelations: RelationMetadata[];
}

Guessing updatedColumns would return an array of updated column names, but it is returning empty array [ ].

Any idea how to get which columns were updated

0

There are 0 best solutions below