Skip to content

Commit

Permalink
fix: Fixed catalog.editProduct function(close #1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Dec 15, 2023
1 parent 2a08124 commit 01c4a18
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/catalog/functions/editProduct.ts
Expand Up @@ -44,12 +44,9 @@ export async function editProduct(
params: editProductParams
): Promise<ProductModel> {
const produto = await assertGetProduct(productId);
produto.name = params.name;
produto.imageCdnUrl = params.image;
produto.description = params.description;
produto.priceAmount1000 = params.price;
produto.isHidden = params.isHidden;
produto.url = params.url;
produto.retailerId = params.retailerId;
return await EditProduct(produto);
Object.keys(params).forEach(
(key) => (params as any)[key] === undefined && delete (params as any)[key]
);
const editedProduct = Object.assign(produto, params);
return await EditProduct(editedProduct);
}

0 comments on commit 01c4a18

Please sign in to comment.