chore: fix problem of transcation beeing commited throw update the "

category variant
This commit is contained in:
mahyargdz
2025-09-21 11:45:24 +03:30
parent 3d1aa01f2e
commit 79f597cc90
23 changed files with 52 additions and 97 deletions
@@ -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 };
}