typeorm#AfterInsert TypeScript Examples

The following examples show how to use typeorm#AfterInsert. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Config.entity.ts    From bouncecode-cms with GNU General Public License v3.0 6 votes vote down vote up
/**
   * 레코드가 수정된 경우 로그를 기록합니다.
   */
  @AfterInsert()
  @AfterUpdate()
  private async handleAfterInsertOrUpdate() {
    const siteLogEntity = new ConfigLogEntity();

    ConfigLogEntity.merge(siteLogEntity, {
      ...this,
      id: undefined,
      originId: this.id,
    });

    return await ConfigLogEntity.insert(siteLogEntity);
  }