Files
klz-cables.com/.pnpm-store/v10/files/e6/31cc81f42229202a0c663263cabc5ee8d7fb0ab2d34b516f602d85eefa1bff61fdc95d9f66f2b2345ed8c13a4543ab46290149058979bf175422a7fc9dffc2
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

43 lines
1.3 KiB
Plaintext

import { buildVersionGlobalFields } 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 updateGlobalVersion({ id, global, locale, req, returning, select, versionData, where: whereArg }) {
const globalConfig = this.payload.globals.config.find(({ slug })=>slug === global);
const whereToUse = whereArg || {
id: {
equals: id
}
};
const tableName = this.tableNameMap.get(`_${toSnakeCase(globalConfig.slug)}${this.versionsSuffix}`);
const fields = buildVersionGlobalFields(this.payload.config, globalConfig, true);
const { where } = buildQuery({
adapter: this,
fields,
locale,
tableName,
where: whereToUse
});
const db = await getTransaction(this, req);
const result = await upsertRow({
id,
adapter: this,
data: versionData,
db,
fields,
globalSlug: global,
ignoreResult: returning === false,
operation: 'update',
req,
select,
tableName,
where
});
if (returning === false) {
return null;
}
return result;
}
//# sourceMappingURL=updateGlobalVersion.js.map