Skip to content

Commit

Permalink
Updated Product search
Browse files Browse the repository at this point in the history
Updated Product search to return products containing the search term instead of the exact name
  • Loading branch information
Subash SN authored Nov 17, 2017
1 parent ff7c94b commit 3ca279f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/appHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports.listProducts = function (req,res){
}

module.exports.productSearch = function (req,res){
db.Product.findAll({where:{name:{[Op.like]:req.body.name}}}).then( products => {
db.Product.findAll({where:{name:{[Op.like]: '%' + req.body.name + '%'}}}).then( products => {
output ={
products : products,
searchTerm: req.body.name
Expand Down

0 comments on commit 3ca279f

Please sign in to comment.