product variant

This commit is contained in:
morteza-mortezai
2025-11-29 09:30:12 +03:30
parent 37ecf9f449
commit 6c8de9867a
2 changed files with 15 additions and 12 deletions
@@ -564,14 +564,14 @@ class ProductService {
// Check if a variant with the same themeValue already exists
// const query: FilterQuery<IProductVariant> = { product: product._id };
// if (addVariantDto.themeValueId) {
// const existingVariant = await this.productVariantRepo.model.findOne({
// product: product._id,
// themeValue: addVariantDto.themeValueId,
// });
if (addVariantDto.themeValueId) {
const existingVariant = await this.productVariantRepo.model.findOne({
product: product._id,
themeValue: addVariantDto.themeValueId,
});
// if (existingVariant) throw new BadRequestError(ProductMessage.VariantAlreadyExists);
// }
if (existingVariant) throw new BadRequestError(ProductMessage.VariantAlreadyExists);
}
const productVariant = await this.createProductVariant(addVariantDto, product._id, shop._id.toString(), session);