pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
Showing only changes of commit 0596bd48e6 - Show all commits

View File

@ -2,11 +2,12 @@
const db = require('../services/dbAccess.services') const db = require('../services/dbAccess.services')
const log = require('../utils/log.utils') const log = require('../utils/log.utils')
const clean = require('../utils/sanitizer.utils')
async function findPisByOrigDest(start,end) { // Probably need to add a sanitize here 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 = start.toLowerCase() const firstCrs = clean.cleanApiEndpointTxt(start.toLowerCase())
const lastCrs = end.toLowerCase() const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase())
const search = db.query("pis", {$and:[{$expr:{$eq:[{$first:"$stops"},firstCrs]}},{$expr:{$eq:[{$last:"$stops"},lastCrs]}}]}) const search = db.query("pis", {$and:[{$expr:{$eq:[{$first:"$stops"},firstCrs]}},{$expr:{$eq:[{$last:"$stops"},lastCrs]}}]})
return search return search
} }