@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 3.2 kB
Source Map (JSON)
{"version":3,"file":"delete-single.mjs","names":["clientIntegrationServices.deleteSingle"],"sources":["../../../../../src/libs/http/controllers/client-integrations/delete-single.ts"],"sourcesContent":["import { createFactory } from \"hono/factory\";\nimport { describeRoute } from \"hono-openapi\";\nimport { controllerSchemas } from \"../../../../schemas/client-integrations.js\";\nimport { clientIntegrationServices } from \"../../../../services/index.js\";\nimport { LucidAPIError } from \"../../../../utils/errors/index.js\";\nimport serviceWrapper from \"../../../../utils/services/service-wrapper.js\";\nimport { copy } from \"../../../i18n/index.js\";\nimport { Permissions } from \"../../../permission/definitions.js\";\nimport authenticate from \"../../middleware/authenticate.js\";\nimport permissions from \"../../middleware/permissions.js\";\nimport validate from \"../../middleware/validate.js\";\nimport validateCSRF from \"../../middleware/validate-csrf.js\";\nimport openAPI from \"../../openapi/index.js\";\nimport createServiceContext from \"../../utils/create-service-context.js\";\n\nconst factory = createFactory();\n\nconst deleteSingleController = factory.createHandlers(\n\tdescribeRoute({\n\t\tdescription: \"Delete a single client integration by ID.\",\n\t\ttags: [\"client-integrations\"],\n\t\tsummary: \"Delete Client Integration\",\n\t\tresponses: openAPI.responses({\n\t\t\tnoProperties: true,\n\t\t}),\n\t\tparameters: openAPI.parameters({\n\t\t\theaders: {\n\t\t\t\tcsrf: true,\n\t\t\t},\n\t\t\tparams: controllerSchemas.deleteSingle.params,\n\t\t}),\n\t}),\n\tvalidateCSRF,\n\tauthenticate(),\n\tpermissions([Permissions.IntegrationDelete]),\n\tvalidate(\"param\", controllerSchemas.deleteSingle.params),\n\tasync (c) => {\n\t\tconst { id } = c.req.valid(\"param\");\n\t\tconst context = createServiceContext(c);\n\n\t\tconst deleteSingleRes = await serviceWrapper(\n\t\t\tclientIntegrationServices.deleteSingle,\n\t\t\t{\n\t\t\t\ttransaction: true,\n\t\t\t\tdefaultError: {\n\t\t\t\t\ttype: \"basic\",\n\t\t\t\t\tname: copy(\n\t\t\t\t\t\t\"server:core.routes.client.integrations.delete.error.message\",\n\t\t\t\t\t),\n\t\t\t\t\tmessage: copy(\n\t\t\t\t\t\t\"server:core.routes.client.integrations.delete.error.message\",\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t)(context, {\n\t\t\tid: Number.parseInt(id, 10),\n\t\t});\n\t\tif (deleteSingleRes.error) throw new LucidAPIError(deleteSingleRes.error);\n\n\t\tc.status(204);\n\t\treturn c.body(null);\n\t},\n);\n\nexport default deleteSingleController;\n"],"mappings":"2vBAiBA,MAAM,EAFU,EAEqB,CAAC,CAAC,eACtC,EAAc,CACb,YAAa,4CACb,KAAM,CAAC,qBAAqB,EAC5B,QAAS,4BACT,UAAW,EAAQ,UAAU,CAC5B,aAAc,EACf,CAAC,EACD,WAAY,EAAQ,WAAW,CAC9B,QAAS,CACR,KAAM,EACP,EACA,OAAQ,EAAkB,aAAa,MACxC,CAAC,CACF,CAAC,EACD,EACA,EAAa,EACb,EAAY,CAAC,EAAY,iBAAiB,CAAC,EAC3C,EAAS,QAAS,EAAkB,aAAa,MAAM,EACvD,KAAO,IAAM,CACZ,GAAM,CAAE,MAAO,EAAE,IAAI,MAAM,OAAO,EAC5B,EAAU,EAAqB,CAAC,EAEhC,EAAkB,MAAM,EAC7BA,EACA,CACC,YAAa,GACb,aAAc,CACb,KAAM,QACN,KAAM,EACL,6DACD,EACA,QAAS,EACR,6DACD,CACD,CACD,CACD,CAAC,CAAC,EAAS,CACV,GAAI,OAAO,SAAS,EAAI,EAAE,CAC3B,CAAC,EACD,GAAI,EAAgB,MAAO,MAAM,IAAI,EAAc,EAAgB,KAAK,EAGxE,OADA,EAAE,OAAO,GAAG,EACL,EAAE,KAAK,IAAI,CACnB,CACD"}