Files
klz-cables.com/.pnpm-store/v10/files/5d/d9c81cb72f194c216b589917c28dddb567523285412cf7dcb71dccfd233165116c7122f033489d2326aee96fa66d202c501e6eec9eb636798dee345bec444b
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

44 lines
1.4 KiB
Plaintext

import { buildVersionCollectionFields } from 'payload';
import toSnakeCase from 'to-snake-case';
import { buildQuery } from './queries/buildQuery.js';
import { upsertRow } from './upsertRow/index.js';
import { getTransaction } from './utilities/getTransaction.js';
export async function updateVersion({ id, collection, locale, req, returning, select, versionData, where: whereArg }) {
const collectionConfig = this.payload.collections[collection].config;
const whereToUse = whereArg || {
id: {
equals: id
}
};
const tableName = this.tableNameMap.get(`_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`);
const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true);
const { where } = buildQuery({
adapter: this,
fields,
locale,
tableName,
where: whereToUse
});
const db = await getTransaction(this, req);
const result = await upsertRow({
id,
adapter: this,
collectionSlug: collection,
data: versionData,
db,
fields,
ignoreResult: returning === false,
joinQuery: false,
operation: 'update',
req,
select,
tableName,
where
});
if (returning === false) {
return null;
}
return result;
}
//# sourceMappingURL=updateVersion.js.map