pis #12
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user