Files
klz-cables.com/.pnpm-store/v10/files/0e/72f1209e4f0a8bcc7fdb2af0c6be15c947289ee67b81f17ab38e3c8340c997695ca76bcf6e718f9b2184341c2cd57249d31f77c8b9686da60a8af151448712
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

26 lines
841 B
Plaintext

import toSnakeCase from 'to-snake-case';
import { buildQuery } from './queries/buildQuery.js';
import { getTransaction } from './utilities/getTransaction.js';
export const count = async function count({ collection, locale, req, where: whereArg }) {
const collectionConfig = this.payload.collections[collection].config;
const tableName = this.tableNameMap.get(toSnakeCase(collectionConfig.slug));
const { joins, where } = buildQuery({
adapter: this,
fields: collectionConfig.flattenedFields,
locale,
tableName,
where: whereArg
});
const db = await getTransaction(this, req);
const countResult = await this.countDistinct({
db,
joins,
tableName,
where
});
return {
totalDocs: countResult
};
};
//# sourceMappingURL=count.js.map