Migrate pis.services to new logger

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-28 12:11:10 +01:00
parent d9e2445141
commit 648c72fa34

View File

@ -1,17 +1,14 @@
// Finds PIS Codes using DB Lookups // Finds PIS Codes using DB Lookups
const db = require("../services/dbAccess.services"); const db = require("../services/dbAccess.services");
const log = require("../utils/logs.utils");
const clean = require("../utils/sanitizer.utils"); const clean = require("../utils/sanitizer.utils");
import { logger } from "../utils/logger.utils";
const supported = ["GW", "UK"]; const supported = ["GW", "UK"];
async function findPisByOrigDest(start, end) { async function findPisByOrigDest(start, end) {
log.out( logger.debug(`pisServices.findPisByOrigDest: Searching for Orig: ${start}, Dest: ${end}`);
"pisServices.findPisByOrigDest: Searching for PIS for Orig: " +
`${start}, Dest: ${end}`,
"dbug"
);
const firstCrs = clean.cleanApiEndpointTxt(start.toLowerCase()); const firstCrs = clean.cleanApiEndpointTxt(start.toLowerCase());
const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase()); const lastCrs = clean.cleanApiEndpointTxt(end.toLowerCase());
const query = { const query = {
@ -33,7 +30,7 @@ async function findPisByOrigDest(start, end) {
} }
async function findPisByCode(code) { async function findPisByCode(code) {
log.out(`pisServices.findPisByCode: Searching for PIS code: ${code}`, "dbug"); logger.debug(`pisServices.findPisByCode: Searching for PIS code: ${code}`);
const cleanCode = clean.removeNonNumeric(code); const cleanCode = clean.removeNonNumeric(code);
const query = { const query = {
code: parseInt(cleanCode), code: parseInt(cleanCode),