typeorm#BeforeUpdate TypeScript Examples

The following examples show how to use typeorm#BeforeUpdate. 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
/**
   * Update 하기 전에 updatedDate 를 설정합니다.
   */
  @BeforeUpdate()
  private handleBeforeUpdate() {
    if (this.deletedBy) {
      this.deletedDate = new Date();
    } else {
      this.updatedDate = new Date();
      this.deletedDate = null;
    }
  }
Example #2
Source File: vulnerability.ts    From crossfeed with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
@BeforeInsert()
  @BeforeUpdate()
  setSeverity() {
    if (!this.cvss) return;
    if (this.cvss === 0) this.severity = 'None';
    else if (this.cvss < 4) this.severity = 'Low';
    else if (this.cvss < 7) this.severity = 'Medium';
    else if (this.cvss < 9) this.severity = 'High';
    else this.severity = 'Critical';
  }
Example #3
Source File: ProductImage.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #4
Source File: CustomerWishlist.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #5
Source File: EmailTemplate.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #6
Source File: LoginLog.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #7
Source File: ManufacturerModel.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #8
Source File: Order.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #9
Source File: OrderLog.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #10
Source File: OrderProduct.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #11
Source File: OrderStatus.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #12
Source File: OrderTotal.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #13
Source File: Page.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #14
Source File: Contact.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #15
Source File: ProductModel.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #16
Source File: ProductToCategory.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #17
Source File: Setting.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #18
Source File: User.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #19
Source File: UserGroup.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #20
Source File: Zone.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #21
Source File: productViewLog.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #22
Source File: stockStatus.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeUpdate()
    public async updateDetails(): Promise<void> {
        this.modifiedDate = moment().format('YYYY-MM-DD HH:mm:ss');
    }
Example #23
Source File: order.entity.ts    From rest-api.ts with MIT License 5 votes vote down vote up
@BeforeInsert()
  @BeforeUpdate()
  async validate() {
    await validateOrReject(this);
  }
Example #24
Source File: Post.ts    From jaebook-server with MIT License 5 votes vote down vote up
@BeforeUpdate()
  async calculateScoreUsingViewAndLike() {
    this.score = Number(this.view) + Number(this.like) * 500;
  }
Example #25
Source File: CashAction.ts    From cashcash-desktop with MIT License 5 votes vote down vote up
@BeforeUpdate()
    beforeUpdate() {
        this.attachAccount();
    }
Example #26
Source File: CashFilter.ts    From cashcash-desktop with MIT License 5 votes vote down vote up
@BeforeUpdate()
    beforeUpdate() {
        this.attachAccount();
    }
Example #27
Source File: CashRule.ts    From cashcash-desktop with MIT License 5 votes vote down vote up
@BeforeUpdate()
    beforeUpdate() {
        this.nameAction();
    }
Example #28
Source File: User.entity.ts    From bouncecode-cms with GNU General Public License v3.0 5 votes vote down vote up
@BeforeInsert()
  @BeforeUpdate()
  private async encryptPassword(): Promise<void> {
    if (this.password) {
      this.passwordEncrypted = await bcrypt.hash(this.password, 10);
      this.password = undefined;
    }
  }
Example #29
Source File: user.ts    From crossfeed with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@BeforeInsert()
  @BeforeUpdate()
  setFullName() {
    this.fullName = this.firstName + ' ' + this.lastName;
  }