dev-api_attributes #2
2
app.js
2
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();
|
||||
|
@ -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 = {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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}`)
|
||||
|
@ -1,4 +1,4 @@
|
||||
function out(msg) {
|
||||
async function out(msg) {
|
||||
var time = new Date().toISOString();
|
||||
console.log(`${time} - ${msg}`)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user