Files
klz-cables.com/.pnpm-store/v10/files/6c/6318e62f11d49c3df6a44776a9437a841a89224477e79f35fe8a68aa839fd357e5221651d22def65dde8481d006738eaf01e59a0253a38b849c0a9c3521137
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

28 lines
1021 B
Plaintext

import { buildVersionGlobalFields } from 'payload';
import toSnakeCase from 'to-snake-case';
import { buildQuery } from './queries/buildQuery.js';
import { getTransaction } from './utilities/getTransaction.js';
export const countGlobalVersions = async function countGlobalVersions({ global, locale, req, where: whereArg }) {
const globalConfig = this.payload.globals.config.find(({ slug })=>slug === global);
const tableName = this.tableNameMap.get(`_${toSnakeCase(globalConfig.slug)}${this.versionsSuffix}`);
const fields = buildVersionGlobalFields(this.payload.config, globalConfig, true);
const { joins, where } = buildQuery({
adapter: this,
fields,
locale,
tableName,
where: whereArg
});
const db = await getTransaction(this, req);
const countResult = await this.countDistinct({
db,
joins,
tableName,
where
});
return {
totalDocs: countResult
};
};
//# sourceMappingURL=countGlobalVersions.js.map