const log  = require('../utils/log.utils');            // Log Helper
const db   = require('../services/dbAccess.services') // DB Access

async function checkCrs(input){
    var INPUT = input.toUpperCase()
    log.out(`ldbUtils.checkCrs: Building database query to find: '${INPUT}'`)
    var query = {'$or':[{'3ALPHA':INPUT},{'TIPLOC':INPUT},{'STANOX':INPUT}]};
    var result = await db.query("stations", query)
    log.out(`ldbUtils.checkCrs: Query results: ${JSON.stringify(result)}`)
    return result
}

module.exports = {
    checkCrs
}