Files
klz-cables.com/.pnpm-store/v10/files/20/6222240303a223ecf7f3cc9331b2b82a9210194938ef0567f5fb78b5aefdc5285e15ab517db9485b70b9703ae2956d3a0df53ad3a246a4d740dacd03260c1f
Marc Mintel 5397309103
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
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

41 lines
1.2 KiB
Plaintext

import { buildVersionCollectionFields, combineQueries } from 'payload';
import toSnakeCase from 'to-snake-case';
import { findMany } from './find/findMany.js';
export const queryDrafts = async function queryDrafts({ collection, joins, limit, locale, page = 1, pagination, req, select, sort, where }) {
const collectionConfig = this.payload.collections[collection].config;
const tableName = this.tableNameMap.get(`_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`);
const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true);
const combinedWhere = combineQueries({
latest: {
equals: true
}
}, where);
const result = await findMany({
adapter: this,
collectionSlug: collection,
fields,
joins,
limit,
locale,
page,
pagination,
req,
select,
sort,
tableName,
versions: true,
where: combinedWhere
});
return {
...result,
docs: result.docs.map((doc)=>{
doc = {
id: doc.parent,
...doc.version
};
return doc;
})
};
};
//# sourceMappingURL=queryDrafts.js.map