Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add type #62

Open
abdelrahman-essawy opened this issue May 30, 2024 · 0 comments
Open

add type #62

abdelrahman-essawy opened this issue May 30, 2024 · 0 comments
Labels

Comments

@abdelrahman-essawy
Copy link
Member

// @ts-expect-error - TODO: add type

    return BrandEntity;
  }

  async beforeInsert(event: InsertEvent<BrandEntity>) {
    if (event.entity.lastSyncAt) return;

    // @ts-expect-error - TODO: add type
    const { newBrand } = await this.magexService.brands.postBrandsCreate({
      formData: {
        name: JSON.stringify(event.entity.name),
        referTo: event.entity.referTo,
      },
    });

    Object.assign(event.entity, newBrand);
    event.entity.lastSyncAt = newBrand.updatedAt;
  }

  async beforeSoftRemove(event: RemoveEvent<BrandEntity>) {
    const brand = event.entity;
    await this.magexService.brands.deleteBrandsDeleteById({
      id: brand._id,
    });
  }

  async beforeUpdate(event: UpdateEvent<BrandEntity>) {
    const brand = event.entity;
    await this.magexService.brands.postBrandsEditById({
      id: brand._id,
      formData: {
        name: JSON.stringify(brand.name),
        referTo: brand.referTo,
      },
    });
  }

  async fetchMagexRecords() {
    // @ts-expect-error - TODO: add type
    this.magexRecords = await this.magexService.brands.getBrandsByAccountName({
      accountName: '[email protected]',
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant