product variant
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user