Files
klz-cables.com/.pnpm-store/v10/files/7d/9154aac00a2dba3a3021e3259efb3d719dc8070540d1ac4d2753804b4604e3bb126ccedd34cafa6db025e628df63951633fa62e8498e6fd1d08bfb078b94c4
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
3.7 KiB
Plaintext

{"version":3,"sources":["../../../src/collections/endpoints/delete.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 { deleteOperation } from '../operations/delete.js'\n\nexport const deleteHandler: PayloadHandler = async (req) => {\n const collection = getRequestCollection(req)\n\n const { depth, overrideLock, populate, select, trash, where } = parseParams(req.query)\n\n const result = await deleteOperation({\n collection,\n depth,\n overrideLock: overrideLock ?? false,\n populate,\n req,\n select,\n trash,\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:deletedCountSuccessfully', {\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\n const message = req.t('error:unableToDeleteCount', {\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","deleteOperation","deleteHandler","req","collection","depth","overrideLock","populate","select","trash","where","query","result","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,EAAEE,KAAK,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGV,YAAYG,IAAIQ,KAAK;IAErF,MAAMC,SAAS,MAAMX,gBAAgB;QACnCG;QACAC;QACAC,cAAcA,gBAAgB;QAC9BC;QACAJ;QACAK;QACAC;QACAC,OAAOA;IACT;IAEA,MAAMG,UAAUd,gBAAgB;QAC9Bc,SAAS,IAAIC;QACbX;IACF;IAEA,IAAIS,OAAOG,MAAM,CAACC,MAAM,KAAK,GAAG;QAC9B,MAAMC,UAAUd,IAAIe,CAAC,CAAC,oCAAoC;YACxDC,OAAOP,OAAOQ,IAAI,CAACJ,MAAM;YACzBK,OAAO1B,eACLS,WAAWkB,MAAM,CAACC,MAAM,CAACX,OAAOQ,IAAI,CAACJ,MAAM,KAAK,IAAI,aAAa,SAAS,EAC1Eb,IAAIqB,IAAI;QA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