chore: fix problem of transcation beeing commited throw update the "
category variant
This commit is contained in:
@@ -239,7 +239,6 @@ class ProductService {
|
||||
await this.checkForDuplicateProduct(createStepOneDto.model);
|
||||
|
||||
const shop = await this.shopeRepo.model.findById(shopId);
|
||||
console.log({ shop, shopId });
|
||||
if (!shop) throw new BadRequestError(ShopMessage.ShopNotFound);
|
||||
|
||||
const createdProduct = await this.productRepo.model.create({
|
||||
@@ -1627,10 +1626,9 @@ class ProductService {
|
||||
|
||||
async deletePopularProduct(productId: number) {
|
||||
await this.validateProduct(productId);
|
||||
const deletedPopular = await this.popularProductRepo.model.findOneAndDelete({
|
||||
await this.popularProductRepo.model.findOneAndDelete({
|
||||
product: productId,
|
||||
});
|
||||
console.log(deletedPopular);
|
||||
return {
|
||||
message: CommonMessage.Deleted,
|
||||
};
|
||||
@@ -1674,7 +1672,6 @@ class ProductService {
|
||||
async updateProduct(productId: number, updateDto: UpdateProductDTO) {
|
||||
const product = await this.validateProduct(productId);
|
||||
const updatedProduct = await this.productRepo.model.findByIdAndUpdate({ _id: product._id }, { ...updateDto }, { new: true });
|
||||
console.log({ updatedProduct });
|
||||
return { updatedProduct };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user