Add mq-client to the 'Versions' response

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-07-28 21:09:44 +01:00
parent 159c46c4cc
commit babd4563dc
2 changed files with 13 additions and 13 deletions

View File

@ -12,7 +12,7 @@ async function get(req, res, next) { // API V1
async function versions(req, res, next) { // API v2
try {
res.json(await stat.versions());
res.json(await stat.getVersions());
} catch (err) {
console.error('Controller Error', err);
err.status = 500;

View File

@ -40,17 +40,16 @@ async function hits(){
return out;
}
async function versions() {
log.out('statsServices.versions: Fetching versions', 'info');
const versions = await db.query('meta', {target: 'versions'});
let data = {
backend: '',
'db-manager': '',
'mq-subscriber': '',
};
data.backend = vers.app;
data['db-manager'] = versions[0]['dbmanager'];
return data;
async function getVersions() {
log.out('statsServices.getVersions: Fetching versions', 'info');
const dbMan = await db.query('versions', {target: 'dbmanager'});
const mqClt = await db.query('versions', {target: 'mq-client'});
const data = {
'backend': vers.app,
'db-manager': dbMan[0]?.['version'] || '',
'mq-client': mqClt[0]?.['version'] || '',
}
return data
}
async function statistics() {
@ -133,5 +132,6 @@ async function statistics() {
module.exports = {
hits,
versions,
statistics
statistics,
getVersions
};