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 async function versions(req, res, next) { // API v2
try { try {
res.json(await stat.versions()); res.json(await stat.getVersions());
} catch (err) { } catch (err) {
console.error('Controller Error', err); console.error('Controller Error', err);
err.status = 500; err.status = 500;

View File

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