added filter to searchProducts controller isActive

master
parent 973cdde5b2
commit 50f6e48219

@ -106,7 +106,10 @@ exports.searchProducts = async (req, res) => {
try {
const { productName } = req.body;
const products = await Product.find({ name: { $regex: new RegExp(productName, 'i') } });
const products = await Product.find({
name: { $regex: new RegExp(productName, 'i') },
isActive: true
});
res.json({products});
} catch (error) {

Loading…
Cancel
Save