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
1 line
1.2 KiB
Plaintext
1 line
1.2 KiB
Plaintext
{"version":3,"sources":["../../../src/folders/hooks/dissasociateAfterDelete.ts"],"sourcesContent":["import type { CollectionAfterDeleteHook } from '../../index.js'\n\ntype Args = {\n collectionSlugs: string[]\n folderFieldName: string\n}\nexport const dissasociateAfterDelete = ({\n collectionSlugs,\n folderFieldName,\n}: Args): CollectionAfterDeleteHook => {\n return async ({ id, req }) => {\n for (const collectionSlug of collectionSlugs) {\n await req.payload.update({\n collection: collectionSlug,\n data: {\n [folderFieldName]: null,\n },\n req,\n where: {\n [folderFieldName]: {\n equals: id,\n },\n },\n })\n }\n }\n}\n"],"names":["dissasociateAfterDelete","collectionSlugs","folderFieldName","id","req","collectionSlug","payload","update","collection","data","where","equals"],"mappings":"AAMA,OAAO,MAAMA,0BAA0B,CAAC,EACtCC,eAAe,EACfC,eAAe,EACV;IACL,OAAO,OAAO,EAAEC,EAAE,EAAEC,GAAG,EAAE;QACvB,KAAK,MAAMC,kBAAkBJ,gBAAiB;YAC5C,MAAMG,IAAIE,OAAO,CAACC,MAAM,CAAC;gBACvBC,YAAYH;gBACZI,MAAM;oBACJ,CAACP,gBAAgB,EAAE;gBACrB;gBACAE;gBACAM,OAAO;oBACL,CAACR,gBAAgB,EAAE;wBACjBS,QAAQR;oBACV;gBACF;YACF;QACF;IACF;AACF,EAAC"} |