Files
klz-cables.com/.pnpm-store/v10/files/66/3d52953a57e6eae94f3cf63ff65690f9fa18f274ea6e805977221f9f622b90002546c907cd9ac651bf8cc3013be4bb377e63155067d935437539eed46933af
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

27 lines
906 B
Plaintext

import toSnakeCase from 'to-snake-case';
import { upsertRow } from './upsertRow/index.js';
import { getTransaction } from './utilities/getTransaction.js';
export async function createGlobal({ slug, data, req, returning }) {
const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
const tableName = this.tableNameMap.get(toSnakeCase(globalConfig.slug));
data.createdAt = new Date().toISOString();
const db = await getTransaction(this, req);
const result = await upsertRow({
adapter: this,
data,
db,
fields: globalConfig.flattenedFields,
globalSlug: slug,
ignoreResult: returning === false,
operation: 'create',
req,
tableName
});
if (returning === false) {
return null;
}
result.globalType = slug;
return result;
}
//# sourceMappingURL=createGlobal.js.map