diff --git a/app.js b/app.js index 634ecca..0dd4fdb 100644 --- a/app.js +++ b/app.js @@ -552,19 +552,21 @@ app.post('/apiPostDailyReport/:apiKey',function(req,res){ // Munka lista lekérése és szűrése AJAX CALL app.get('/filter', utils.ensureAuthenticated, async function(req, res) { //console.log(req.query.year.value); - + const year=new RegExp("^"+req.query.year); + const condition=new RegExp("^"+req.query.condition); + var query={ $or:[ - {"megrendelo": { "$regex": req.query.condition, "$options": "i" }}, + {"megrendelo": { "$regex": condition, "$options": "i" }}, {$and: [ - {"workDate": { "$regex": req.query.year, "$options": "i" }}, - {"title":{ "$regex": req.query.condition, "$options": "i" }} + {"workDate": { "$regex": year, "$options": "i" }}, + {"title":{ "$regex": condition, "$options": "i" }} ] },{$and: [ - {"workDate": { "$regex": req.query.year, "$options": "i" }}, - {"poNumber":{ "$regex": req.query.condition, "$options": "i" }} + {"workDate": { "$regex": year, "$options": "i" }}, + {"poNumber":{ "$regex": condition, "$options": "i" }} ] } ] diff --git a/package.json b/package.json index 54d6fbf..6435e1c 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "lightpick": "^1.6.2", "moment": "^2.29.1", "moment-range": "^4.0.2", - "mongoose": "^5.11.19", + "mongoose": "^5.13.5", "mongoose-auto-increment": "^3.0.1", "mongoose-increment": "^2.0.0", "multer": "^1.4.2",