@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.48 kB
Source Map (JSON)
{"version":3,"file":"delete-for-documents.mjs","names":[],"sources":["../../../src/services/document-workflows/delete-for-documents.ts"],"sourcesContent":["import { DocumentWorkflowsRepository } from \"../../libs/repositories/index.js\";\nimport type { ServiceFn } from \"../../utils/services/types.js\";\n\nconst deleteForDocuments: ServiceFn<\n\t[\n\t\t{\n\t\t\tcollectionKey: string;\n\t\t\tdocumentIds: number[];\n\t\t},\n\t],\n\tundefined\n> = async (context, data) => {\n\tif (data.documentIds.length === 0) {\n\t\treturn {\n\t\t\terror: undefined,\n\t\t\tdata: undefined,\n\t\t};\n\t}\n\n\tconst Workflows = new DocumentWorkflowsRepository(\n\t\tcontext.db.client,\n\t\tcontext.config.db,\n\t);\n\n\tconst deleteRes = await Workflows.deleteMultiple({\n\t\twhere: [\n\t\t\t{ key: \"collection_key\", operator: \"=\", value: data.collectionKey },\n\t\t\t{ key: \"document_id\", operator: \"in\", value: data.documentIds },\n\t\t],\n\t});\n\tif (deleteRes.error) return deleteRes;\n\n\treturn {\n\t\terror: undefined,\n\t\tdata: undefined,\n\t};\n};\n\nexport default deleteForDocuments;\n"],"mappings":"8DAGA,MAAM,EAQF,MAAO,EAAS,IAAS,CAC5B,GAAI,EAAK,YAAY,SAAW,EAC/B,MAAO,CACN,MAAO,IAAA,GACP,KAAM,IAAA,EACP,EAQD,IAAM,EAAY,MAAM,IALF,EACrB,EAAQ,GAAG,OACX,EAAQ,OAAO,EAGgB,CAAC,CAAC,eAAe,CAChD,MAAO,CACN,CAAE,IAAK,iBAAkB,SAAU,IAAK,MAAO,EAAK,aAAc,EAClE,CAAE,IAAK,cAAe,SAAU,KAAM,MAAO,EAAK,WAAY,CAC/D,CACD,CAAC,EAGD,OAFI,EAAU,MAAc,EAErB,CACN,MAAO,IAAA,GACP,KAAM,IAAA,EACP,CACD"}