Files
klz-cables.com/.pnpm-store/v10/files/ae/a0ff7d18dbbac17206c832440394d682b0b04172790cf8669333d80b14e58e7c9a239cca0c2f17237e91d298a045ce4c70516072f600c69b43ca4a8b6d3217
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

1 line
4.1 KiB
Plaintext

{"version":3,"sources":["../../../src/collections/endpoints/update.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport { status as httpStatus } from 'http-status'\n\nimport type { PayloadHandler } from '../../config/types.js'\n\nimport { getRequestCollection } from '../../utilities/getRequestEntity.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { parseParams } from '../../utilities/parseParams/index.js'\nimport { updateOperation } from '../operations/update.js'\n\nexport const updateHandler: PayloadHandler = async (req) => {\n const collection = getRequestCollection(req)\n\n const {\n depth,\n draft,\n limit,\n overrideLock,\n populate,\n publishAllLocales,\n select,\n sort,\n trash,\n unpublishAllLocales,\n where,\n } = parseParams(req.query)\n\n const result = await updateOperation({\n collection,\n data: req.data!,\n depth,\n draft,\n limit,\n overrideLock: overrideLock ?? false,\n populate,\n publishAllLocales,\n req,\n select,\n sort,\n trash,\n unpublishAllLocales,\n where: where!,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length === 1 ? 'singular' : 'plural'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n result.errors = result.errors.map((error) =>\n error.isPublic\n ? error\n : {\n ...error,\n message: 'Something went wrong.',\n },\n )\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total === 1 ? 'singular' : 'plural'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"names":["getTranslation","status","httpStatus","getRequestCollection","headersWithCors","parseParams","updateOperation","updateHandler","req","collection","depth","draft","limit","overrideLock","populate","publishAllLocales","select","sort","trash","unpublishAllLocales","where","query","result","data","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","OK","map","error","isPublic","total","BAD_REQUEST"],"mappings":"AAAA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,UAAUC,UAAU,QAAQ,cAAa;AAIlD,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,WAAW,QAAQ,uCAAsC;AAClE,SAASC,eAAe,QAAQ,0BAAyB;AAEzD,OAAO,MAAMC,gBAAgC,OAAOC;IAClD,MAAMC,aAAaN,qBAAqBK;IAExC,MAAM,EACJE,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,iBAAiB,EACjBC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,mBAAmB,EACnBC,KAAK,EACN,GAAGf,YAAYG,IAAIa,KAAK;IAEzB,MAAMC,SAAS,MAAMhB,gBAAgB;QACnCG;QACAc,MAAMf,IAAIe,IAAI;QACdb;QACAC;QACAC;QACAC,cAAcA,gBAAgB;QAC9BC;QACAC;QACAP;QACAQ;QACAC;QACAC;QACAC;QACAC,OAAOA;IACT;IAEA,MAAMI,UAAUpB,gBAAgB;QAC9BoB,SAAS,IAAIC;QACbjB;IACF;IAEA,IAAIc,OA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