From c0c50d0e5bcd1e089b43dfed662f1678d2b49f6a Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 22:01:45 +0100 Subject: [PATCH] eslint fixes Signed-off-by: Fred Boniface --- src/services/pis.services.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/services/pis.services.js b/src/services/pis.services.js index 60423b8..f72050f 100644 --- a/src/services/pis.services.js +++ b/src/services/pis.services.js @@ -5,25 +5,25 @@ const log = require('../utils/log.utils') const clean = require('../utils/sanitizer.utils') async function findPisByOrigDest(start,end) { - log.out(`pisServices.findPisByOrigDest: Searching for PIS for Orig: ${start}, Dest: ${end}`, "dbug") + log.out(`pisServices.findPisByOrigDest: Searching for PIS for Orig: ${start}, Dest: ${end}`, 'dbug') const firstCrs = clean.cleanApiEndpointTxt(start.toLowerCase()) const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase()) const query = { - stops: { - $all: [ - { $elemMatch: { $eq: firstCrs } }, - { $elemMatch: { $eq: lastCrs } } - ] - }, - $expr: { - $and: [ - { $eq: [{ $arrayElemAt: [ "$stops", -1 ] }, lastCrs] }, - { $eq: [{ $arrayElemAt: [ "$stops", 0 ] }, firstCrs] } - ] - } + stops: { + $all: [ + { $elemMatch: { $eq: firstCrs } }, + { $elemMatch: { $eq: lastCrs } } + ] + }, + $expr: { + $and: [ + { $eq: [{ $arrayElemAt: [ '$stops', -1 ] }, lastCrs] }, + { $eq: [{ $arrayElemAt: [ '$stops', 0 ] }, firstCrs] } + ] + } } //const oldQuery = {$and:[{$expr:{$eq:[{$first:"$stops"},firstCrs]}},{$expr:{$eq:[{$last:"$stops"},lastCrs]}}]} - const search = db.query("pis", query) + const search = db.query('pis', query) return search }