newStaffLDB-API #48
@ -1,16 +1,17 @@
|
|||||||
// Parse and return a find request
|
// Parse and return a find request
|
||||||
|
|
||||||
const log = require("../utils/logs.utils"); // Log Helper
|
|
||||||
const db = require("../services/dbAccess.services");
|
const db = require("../services/dbAccess.services");
|
||||||
const san = require("../utils/sanitizer.utils");
|
const san = require("../utils/sanitizer.utils");
|
||||||
|
|
||||||
|
import { logger } from "../utils/logger.utils";
|
||||||
|
|
||||||
// DB Query: query(collection, query)
|
// DB Query: query(collection, query)
|
||||||
|
|
||||||
// Define collection as all queries are for the "corpus" collection.
|
// Define collection as all queries are for the "corpus" collection.
|
||||||
const col = "corpus";
|
const col = "corpus";
|
||||||
|
|
||||||
async function name(id) {
|
async function name(id) {
|
||||||
log.out(`findServices.name: Finding station name: ${id}`, "info");
|
logger.debug(`findServices.name: Finding station name: ${id}`);
|
||||||
var name = san.cleanApiEndpointTxt(id.toUpperCase());
|
var name = san.cleanApiEndpointTxt(id.toUpperCase());
|
||||||
let query = { NLCDESC: name };
|
let query = { NLCDESC: name };
|
||||||
//var data = await db.query(col,query)
|
//var data = await db.query(col,query)
|
||||||
@ -18,7 +19,7 @@ async function name(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function crs(id) {
|
async function crs(id) {
|
||||||
log.out(`findServices.crs: Finding crs: ${id}`, "info");
|
logger.debug(`findServices.crs: Finding crs: ${id}`);
|
||||||
var crs = san.cleanApiEndpointTxt(id.toUpperCase());
|
var crs = san.cleanApiEndpointTxt(id.toUpperCase());
|
||||||
let query = { "3ALPHA": crs };
|
let query = { "3ALPHA": crs };
|
||||||
//var data = await db.query(col,query)
|
//var data = await db.query(col,query)
|
||||||
@ -26,16 +27,16 @@ async function crs(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function nlc(id) {
|
async function nlc(id) {
|
||||||
log.out(`findServices.nlc: Finding nlc: ${id}`, "info");
|
logger.debug(`findServices.nlc: Finding nlc: ${id}`);
|
||||||
var nlc = san.cleanApiEndpointNum(id);
|
var nlc = san.cleanApiEndpointNum(id);
|
||||||
let query = { NLC: parseInt(nlc) };
|
let query = { NLC: parseInt(nlc) };
|
||||||
log.out(`findServices.nlc: NLC Converted to int: ${query}`, "info");
|
logger.trace(`findServices.nlc: NLC Converted to int: ${query}`);
|
||||||
//var data = await db.query(col,query)
|
//var data = await db.query(col,query)
|
||||||
return await db.query(col, query);
|
return await db.query(col, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function tiploc(id) {
|
async function tiploc(id) {
|
||||||
log.out(`findServices.tiploc: Finding tiploc: ${id}`, "info");
|
logger.debug(`findServices.tiploc: Finding tiploc: ${id}`);
|
||||||
var tiploc = san.cleanApiEndpointTxt(id.toUpperCase());
|
var tiploc = san.cleanApiEndpointTxt(id.toUpperCase());
|
||||||
let query = { TIPLOC: tiploc };
|
let query = { TIPLOC: tiploc };
|
||||||
//var data = await db.query(col,query)
|
//var data = await db.query(col,query)
|
||||||
@ -43,7 +44,7 @@ async function tiploc(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function stanox(id) {
|
async function stanox(id) {
|
||||||
log.out(`findServices.stanox: Finding stanox: ${id}`, "info");
|
logger.debug(`findServices.stanox: Finding stanox: ${id}`);
|
||||||
var stanox = san.cleanApiEndpointNum(id);
|
var stanox = san.cleanApiEndpointNum(id);
|
||||||
let query = { STANOX: String(stanox) };
|
let query = { STANOX: String(stanox) };
|
||||||
//var data = await db.query(col,query)
|
//var data = await db.query(col,query)
|
||||||
|
Loading…
Reference in New Issue
Block a user