Removed unneccesary vars and added notes for tidyup

in preparation for testing additional info

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-02-16 10:39:19 +00:00
parent 2326a97d35
commit b1940bcfbb
5 changed files with 17 additions and 15 deletions

2
app.js
View File

@ -8,6 +8,8 @@
// container should be used for this. See the dockerfile under /static // container should be used for this. See the dockerfile under /static
// for this. // for this.
console.log(`Initialising OwlBoard`)
// External Requires // External Requires
const express = require('express'); const express = require('express');
const app = express(); const app = express();

View File

@ -13,16 +13,16 @@ async function name(id){
log.out(`findServices.name: Finding station name: ${id}`) log.out(`findServices.name: Finding station name: ${id}`)
var name = san.cleanApiEndpointTxt(id.toUpperCase()) var name = san.cleanApiEndpointTxt(id.toUpperCase())
query = {NLCDESC: name} query = {NLCDESC: name}
var data = await db.query(col,query) //var data = await db.query(col,query)
return data return await db.query(col,query)
} }
async function crs(id){ async function crs(id){
log.out(`findServices.crs: Finding crs: ${id}`) log.out(`findServices.crs: Finding crs: ${id}`)
var crs = san.cleanApiEndpointTxt(id.toUpperCase()) var crs = san.cleanApiEndpointTxt(id.toUpperCase())
query = {'3ALPHA': crs} query = {'3ALPHA': crs}
var data = await db.query(col,query) //var data = await db.query(col,query)
return data return await db.query(col,query)
} }
async function nlc(id){ async function nlc(id){
@ -30,24 +30,24 @@ async function nlc(id){
var nlc = san.cleanApiEndpointNum(id) var nlc = san.cleanApiEndpointNum(id)
query = {NLC: parseInt(nlc)} query = {NLC: parseInt(nlc)}
log.out(`findServices.nlc: NLC Converted to int: ${query}`) log.out(`findServices.nlc: NLC Converted to int: ${query}`)
var data = await db.query(col,query) //var data = await db.query(col,query)
return data return await db.query(col,query)
} }
async function tiploc(id){ async function tiploc(id){
log.out(`findServices.tiploc: Finding tiploc: ${id}`) log.out(`findServices.tiploc: Finding tiploc: ${id}`)
var tiploc = san.cleanApiEndpointTxt(id.toUpperCase()) var tiploc = san.cleanApiEndpointTxt(id.toUpperCase())
query = {TIPLOC: tiploc} query = {TIPLOC: tiploc}
var data = await db.query(col,query) //var data = await db.query(col,query)
return data return await db.query(col,query)
} }
async function stanox(id){ async function stanox(id){
log.out(`findServices.stanox: Finding stanox: ${id}`) log.out(`findServices.stanox: Finding stanox: ${id}`)
var stanox = san.cleanApiEndpointNum(id) var stanox = san.cleanApiEndpointNum(id)
query = {STANOX: String(stanox)} query = {STANOX: String(stanox)}
var data = await db.query(col,query) //var data = await db.query(col,query)
return data return await db.query(col,query)
} }
module.exports = { module.exports = {

View File

@ -3,11 +3,11 @@ const db = require('../services/dbAccess.services')
const os = require('os') const os = require('os')
async function hits(){ async function hits(){
var dat = await db.query("meta", {target: "counters"}); var dat = db.query("meta", {target: "counters"});
log.out(`listServices.meta: fetched server meta`) log.out(`listServices.meta: fetched server meta`)
let out = {} let out = {}
out.host = os.hostname() out.host = os.hostname()
out.dat = dat out.dat = await dat
return out; return out;
} }

View File

@ -11,7 +11,7 @@ async function checkCrs(input){
return result return result
} }
async function cleanMessages(input){ async function cleanMessages(input){ // Needs to be moved to the frontend `ensureArray() func`
var out = [] var out = []
if (typeof input.message == "string") { if (typeof input.message == "string") {
out.push(await san.cleanNrcc(input.message)) out.push(await san.cleanNrcc(input.message))
@ -24,7 +24,7 @@ async function cleanMessages(input){
} }
// Accepts an object but not an Array and returns it wrapped in an array. // Accepts an object but not an Array and returns it wrapped in an array.
async function cleanServices(input){ async function cleanServices(input){ // Need to triple check but I don't think this is used anymore.
var out = [] var out = []
if (!Array.isArray(input)) { if (!Array.isArray(input)) {
log.out(`ldbUtils.cleanServices: Transforming input: ${input}`) log.out(`ldbUtils.cleanServices: Transforming input: ${input}`)

View File

@ -1,4 +1,4 @@
function out(msg) { async function out(msg) {
var time = new Date().toISOString(); var time = new Date().toISOString();
console.log(`${time} - ${msg}`) console.log(`${time} - ${msg}`)
} }