diff --git a/src/proxy/transformers/__tests__/workflow-rbac-test.js b/src/proxy/transformers/__tests__/workflow-rbac-test.js index 06e7a0b..f12a884 100644 --- a/src/proxy/transformers/__tests__/workflow-rbac-test.js +++ b/src/proxy/transformers/__tests__/workflow-rbac-test.js @@ -124,7 +124,7 @@ describe('Workflow transformers', () => { transformer(mockIdentity(), mockReq, null, callback); }).then(() => { expect(mockReq.url).toStrictEqual( - '/api/workflow/search-v2?' + + '/api/workflow/search?' + escape('status IN (FAILED)') + '=&query=' + escape("correlationId='fb.com'"), diff --git a/src/proxy/transformers/workflow.js b/src/proxy/transformers/workflow.js index bc729c5..ae4b50f 100644 --- a/src/proxy/transformers/workflow.js +++ b/src/proxy/transformers/workflow.js @@ -49,7 +49,7 @@ export const getSearchBefore: BeforeFun = ( newQueryString = updateQuery(newQueryString, limitToUser); } - req.url = req._parsedUrl.pathname + '-v2?' + newQueryString; + req.url = `${req._parsedUrl.pathname}?${newQueryString}`; proxyCallback(); }; diff --git a/src/routes.js b/src/routes.js index 63bf399..94530b5 100644 --- a/src/routes.js +++ b/src/routes.js @@ -65,25 +65,26 @@ const findSchedule = (schedules, name) => { searching executed workflows by freeText search query. If input parameters are not valid, function return exception with an array object with status and error message. */ export function format_query(req) { + const UNDEFINED = 'undefined'; const query = []; console.log(req.query); if ( - typeof req.query.workflowId !== 'undefined' && + typeof req.query.workflowId !== UNDEFINED && req.query.workflowId !== '' ) { if (req.query.workflowId.match(uuid_regex) !== null) { - query.push("workflowId='" + req.query.workflowId + "'"); + query.push(`workflowId='${req.query.workflowId}'`); } else if ( - typeof req.query.workflowId !== 'undefined' && + typeof req.query.workflowId !== UNDEFINED && req.query.workflowId.match(uuid_regex) === null ) { - query.push("workflowType='" + req.query.workflowId + "'"); + query.push(`workflowType='${req.query.workflowId}'`); } } - if (typeof req.query.status !== 'undefined' && req.query.status !== '') { + if (typeof req.query.status !== UNDEFINED && req.query.status !== '') { if (WORKFLOW_STATUS_TYPES.includes(req.query.status)) { query.push("status='" + req.query.status + "'"); } else {