Update reasonCode endpoints to read from DB rather than API

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-06-12 18:28:28 +01:00
parent 4916c377c6
commit f0b8e46007
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,6 @@
const version = { const version = {
api: ['/api/v1/',], api: ['/api/v1/',],
app: '2023.6.5' app: '2023.6.6'
}; };
module.exports = version; module.exports = version;

View File

@ -88,9 +88,8 @@ async function getServiceByRID(rid) {
async function getReasonCodeList() { async function getReasonCodeList() {
log.out('ldbService.getReasonCodeList: Fetching reason code list', 'eror'); log.out('ldbService.getReasonCodeList: Fetching reason code list', 'eror');
try { try {
const api = new ldb(ldbsvKey,true); const dbFilter = {};
const options = {}; return await db.query('reasonCodes', dbFilter, false);
return await api.call('GetReasonCodeList', options, true, false);
} catch (err) { } catch (err) {
log.out(`ldbService.getReasonCodeList: ${err}`, 'eror'); log.out(`ldbService.getReasonCodeList: ${err}`, 'eror');
} }
@ -99,8 +98,10 @@ async function getReasonCodeList() {
async function getReasonCode(code) { async function getReasonCode(code) {
log.out(`ldbService.getReasonCode: Fetching reason code ${code}`, 'dbug'); log.out(`ldbService.getReasonCode: Fetching reason code ${code}`, 'dbug');
try { try {
const api = new ldb(ldbsvKey, true); const dbFilter = {
return await api.call('GetReasonCode', {reasonCode: code}, true, false); code: code
};
return await db.query('reasonCodes', dbFilter, false);
} catch (err) { } catch (err) {
log.out(`ldbService.getReasonCode: ${err}`, 'eror'); log.out(`ldbService.getReasonCode: ${err}`, 'eror');
} }