added filter to searchProducts controller isActive

master
parent 973cdde5b2
commit 50f6e48219

@ -106,7 +106,10 @@ exports.searchProducts = async (req, res) => {
try { try {
const { productName } = req.body; 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}); res.json({products});
} catch (error) { } catch (error) {

Loading…
Cancel
Save