@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.3 kB
Source Map (JSON)
{"version":3,"file":"delete-single.mjs","names":[],"sources":["../../../../src/services/collections/jobs/delete-single.ts"],"sourcesContent":["import { CollectionsRepository } from \"../../../libs/repositories/index.js\";\nimport type { ServiceFn } from \"../../../utils/services/types.js\";\n\n/**\n * Deletes a single collection\n */\nconst deleteCollection: ServiceFn<\n\t[\n\t\t{\n\t\t\tcollectionKey: string;\n\t\t},\n\t],\n\tundefined\n> = async (context, data) => {\n\tconst Collections = new CollectionsRepository(\n\t\tcontext.db.client,\n\t\tcontext.config.db,\n\t);\n\n\tconst deleteRes = await Collections.deleteSingle({\n\t\twhere: [\n\t\t\t{\n\t\t\t\tkey: \"key\",\n\t\t\t\toperator: \"=\",\n\t\t\t\tvalue: data.collectionKey,\n\t\t\t},\n\t\t],\n\t\treturning: [\"key\"],\n\t\tvalidation: {\n\t\t\tenabled: true,\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 deleteCollection;\n"],"mappings":"0DAMA,MAAM,EAOF,MAAO,EAAS,IAAS,CAM5B,IAAM,EAAY,MAAM,IALA,EACvB,EAAQ,GAAG,OACX,EAAQ,OAAO,EAGkB,CAAC,CAAC,aAAa,CAChD,MAAO,CACN,CACC,IAAK,MACL,SAAU,IACV,MAAO,EAAK,aACb,CACD,EACA,UAAW,CAAC,KAAK,EACjB,WAAY,CACX,QAAS,EACV,CACD,CAAC,EAGD,OAFI,EAAU,MAAc,EAErB,CACN,MAAO,IAAA,GACP,KAAM,IAAA,EACP,CACD"}