Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Jun 26, 2024
1 parent 0e3c0b4 commit 783d159
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ module.exports = function(mysqlConfig, logger, writeMysqlConfig = null) {
lookupCarrierByAccountLcr: require('./lib/lookup-carrier-by-account-lcr').bind(null, pool, logger),
lookupOutboundCarrierForAccount: require('./lib/lookup-outbound-carrier-for-account').bind(null, pool, logger),
lookupClientByAccountAndUsername: require('./lib/lookup-client-by-account-username').bind(null, pool, logger),
lookupSystemInformation: require('./lib/lookup-system-information').bind(null, pool, logger),
lookupSystemInformation: require('./lib/lookup-system-information').bind(null, pool, logger)
};
};
12 changes: 12 additions & 0 deletions lib/lookup-system-information.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const debug = require('debug')('jambonz:db-helpers');

const sql = 'SELECT * FROM system_information';

async function lookupSystemInformation(pool, logger) {
const pp = pool.promise();
const [r] = await pp.execute(sql);
debug(`results: ${JSON.stringify(r)}`);
return r.length > 0 ? r[0] : null;
}

module.exports = lookupSystemInformation;
2 changes: 1 addition & 1 deletion test/system-information.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('system_information tests', async(t) => {
try {
let info = await lookupSystemInformation();
console.log({info});
t.ok(info.length === 1 && info[0].domain === 'jambonz.xyz', 'found system information');
t.ok(info.length === 1 && info[0].domain_name === 'jambonz.xyz', 'found system information');

t.end();
}
Expand Down

0 comments on commit 783d159

Please sign in to comment.