From b1940bcfbb133b5ef4047415c7cad77bc81f7498 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 16 Feb 2023 10:39:19 +0000 Subject: [PATCH] Removed unneccesary vars and added notes for tidyup in preparation for testing additional info Signed-off-by: Fred Boniface --- app.js | 2 ++ src/services/find.services.js | 20 ++++++++++---------- src/services/stats.services.js | 4 ++-- src/utils/ldb.utils.js | 4 ++-- src/utils/log.utils.js | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app.js b/app.js index 33ba1a6..44b311b 100644 --- a/app.js +++ b/app.js @@ -8,6 +8,8 @@ // container should be used for this. See the dockerfile under /static // for this. +console.log(`Initialising OwlBoard`) + // External Requires const express = require('express'); const app = express(); diff --git a/src/services/find.services.js b/src/services/find.services.js index 0cf7807..c57903a 100644 --- a/src/services/find.services.js +++ b/src/services/find.services.js @@ -13,16 +13,16 @@ async function name(id){ log.out(`findServices.name: Finding station name: ${id}`) var name = san.cleanApiEndpointTxt(id.toUpperCase()) query = {NLCDESC: name} - var data = await db.query(col,query) - return data + //var data = await db.query(col,query) + return await db.query(col,query) } async function crs(id){ log.out(`findServices.crs: Finding crs: ${id}`) var crs = san.cleanApiEndpointTxt(id.toUpperCase()) query = {'3ALPHA': crs} - var data = await db.query(col,query) - return data + //var data = await db.query(col,query) + return await db.query(col,query) } async function nlc(id){ @@ -30,24 +30,24 @@ async function nlc(id){ var nlc = san.cleanApiEndpointNum(id) query = {NLC: parseInt(nlc)} log.out(`findServices.nlc: NLC Converted to int: ${query}`) - var data = await db.query(col,query) - return data + //var data = await db.query(col,query) + return await db.query(col,query) } async function tiploc(id){ log.out(`findServices.tiploc: Finding tiploc: ${id}`) var tiploc = san.cleanApiEndpointTxt(id.toUpperCase()) query = {TIPLOC: tiploc} - var data = await db.query(col,query) - return data + //var data = await db.query(col,query) + return await db.query(col,query) } async function stanox(id){ log.out(`findServices.stanox: Finding stanox: ${id}`) var stanox = san.cleanApiEndpointNum(id) query = {STANOX: String(stanox)} - var data = await db.query(col,query) - return data + //var data = await db.query(col,query) + return await db.query(col,query) } module.exports = { diff --git a/src/services/stats.services.js b/src/services/stats.services.js index 7d31ca2..572c361 100644 --- a/src/services/stats.services.js +++ b/src/services/stats.services.js @@ -3,11 +3,11 @@ const db = require('../services/dbAccess.services') const os = require('os') 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`) let out = {} out.host = os.hostname() - out.dat = dat + out.dat = await dat return out; } diff --git a/src/utils/ldb.utils.js b/src/utils/ldb.utils.js index 846f30d..dea6eae 100644 --- a/src/utils/ldb.utils.js +++ b/src/utils/ldb.utils.js @@ -11,7 +11,7 @@ async function checkCrs(input){ return result } -async function cleanMessages(input){ +async function cleanMessages(input){ // Needs to be moved to the frontend `ensureArray() func` var out = [] if (typeof input.message == "string") { 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. -async function cleanServices(input){ +async function cleanServices(input){ // Need to triple check but I don't think this is used anymore. var out = [] if (!Array.isArray(input)) { log.out(`ldbUtils.cleanServices: Transforming input: ${input}`) diff --git a/src/utils/log.utils.js b/src/utils/log.utils.js index a79b8e8..de25c66 100644 --- a/src/utils/log.utils.js +++ b/src/utils/log.utils.js @@ -1,4 +1,4 @@ -function out(msg) { +async function out(msg) { var time = new Date().toISOString(); console.log(`${time} - ${msg}`) }