dev-api_attributes #2

Merged
fred.boniface merged 3 commits from dev-api_attributes into main 2023-02-21 11:06:56 +00:00
5 changed files with 17 additions and 15 deletions
Showing only changes of commit b1940bcfbb - Show all commits

2
app.js
View File

@ -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();

View File

@ -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 = {

View File

@ -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;
}

View File

@ -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}`)

View File

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