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
46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
import { buildOrderBy } from './buildOrderBy.js';
|
|
import { parseParams } from './parseParams.js';
|
|
export const buildQuery = function buildQuery({ adapter, aliasTable, fields, joins = [], locale, parentIsLocalized, selectLocale, sort, tableName, where: incomingWhere }) {
|
|
const selectFields = {
|
|
id: adapter.tables[tableName].id
|
|
};
|
|
let where;
|
|
const context = {
|
|
sort
|
|
};
|
|
if (incomingWhere && Object.keys(incomingWhere).length > 0) {
|
|
where = parseParams({
|
|
adapter,
|
|
aliasTable,
|
|
context,
|
|
fields,
|
|
joins,
|
|
locale,
|
|
parentIsLocalized,
|
|
selectFields,
|
|
selectLocale,
|
|
tableName,
|
|
where: incomingWhere
|
|
});
|
|
}
|
|
const orderBy = buildOrderBy({
|
|
adapter,
|
|
aliasTable,
|
|
fields,
|
|
joins,
|
|
locale,
|
|
parentIsLocalized,
|
|
rawSort: context.rawSort,
|
|
selectFields,
|
|
sort: context.sort,
|
|
tableName
|
|
});
|
|
return {
|
|
joins,
|
|
orderBy,
|
|
selectFields,
|
|
where
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=buildQuery.js.map |