From cf93e728b22319eaa9cd1234b29dc8f912f56719 Mon Sep 17 00:00:00 2001 From: theo Date: Tue, 18 Jun 2024 15:12:26 +0200 Subject: [PATCH] hotfix db function on utils args inside the WHERE clause of the query didn't work anymore --- force-app/main/default/lwc/bolt/utils.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/force-app/main/default/lwc/bolt/utils.js b/force-app/main/default/lwc/bolt/utils.js index 212cb20..d8ea235 100644 --- a/force-app/main/default/lwc/bolt/utils.js +++ b/force-app/main/default/lwc/bolt/utils.js @@ -144,16 +144,15 @@ export const soql = async (req, ...args ) => { if(args[i]) { const argName = `arg${i}`; const _curr = curr.toLocaleLowerCase() - if( - (_curr.includes('from') && !_curr.includes('where')) - || _curr.includes('select') - ) { - if(args[i] instanceof Array) + switch(true) { + case _curr.includes('where'): + params[argName] = args[i] + return `${acc}${curr}:${argName}`; + case _curr.includes('select') && args[i] instanceof Array: return `${acc}${curr}${args[i].join(',')}`; - else return `${acc}${curr}${args[i]}`; - } else { - params[argName] = args[i]; - return `${acc}${curr}:${argName}`; + case _curr.includes('from'): + case _curr.includes('select'): + return `${acc}${curr}${args[i]}`; } } else if(args.length === 0) return curr else return `${acc}${curr}`;