From 966e2402679b85e14b5f9dae78fb69b7748a9412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincze=20J=C3=B3zsef?= Date: Thu, 6 Feb 2025 15:30:02 +0100 Subject: [PATCH] =?UTF-8?q?Mongoose=20friss=C3=ADtve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 14 ++++++++------ package.json | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) 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",