Skip to content

Commit

Permalink
fix: fetch makers correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
karimdaghari committed Feb 12, 2020
1 parent 415216b commit 2c4e726
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/product/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ProductService {
where: {
id
},
relations: ['links']
relations: ['links', 'makers']
});
}

Expand Down Expand Up @@ -172,10 +172,10 @@ export class ProductService {

async deleteProduct(id: number): Promise<boolean> {
const product = await this.fetchProductById(id);
const makers = product.makers.map(m => m.id);
const makers = product.makers.map(m => +m.id);
await this.productRepository.remove(product);
for (let i = 0; i < makers.length; i++) {
await this.userService.setUserAsNormal(i);
await this.userService.setUserAsNormal(makers[i]);
}
await this.productLinksService.deleteLinks(product.linksId);
try {
Expand Down

0 comments on commit 2c4e726

Please sign in to comment.