Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
import { parseParams } from './parseParams.js';
|
|
export function buildAndOrConditions({ adapter, aliasTable, context, fields, joins, locale, parentIsLocalized, selectFields, selectLocale, tableName, where }) {
|
|
const completedConditions = [];
|
|
// Loop over all AND / OR operations and add them to the AND / OR query param
|
|
// Operations should come through as an array
|
|
for (const condition of where){
|
|
// If the operation is properly formatted as an object
|
|
if (typeof condition === 'object') {
|
|
const result = parseParams({
|
|
adapter,
|
|
aliasTable,
|
|
context,
|
|
fields,
|
|
joins,
|
|
locale,
|
|
parentIsLocalized,
|
|
selectFields,
|
|
selectLocale,
|
|
tableName,
|
|
where: condition
|
|
});
|
|
if (result && Object.keys(result).length > 0) {
|
|
completedConditions.push(result);
|
|
}
|
|
}
|
|
}
|
|
return completedConditions;
|
|
}
|
|
|
|
//# sourceMappingURL=buildAndOrConditions.js.map |