@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.45 kB
JavaScript
import{copy as e}from"../../../i18n/copy.mjs";import t from"../../../../utils/errors/lucid-api-error.mjs";import{controllerSchemas as n}from"../../../../schemas/email.mjs";import r from"../../utils/create-service-context.mjs";import i from"../../../../services/email/get-single.mjs";import a from"../../../../utils/services/service-wrapper.mjs";import{Permissions as o}from"../../../permission/definitions.mjs";import s from"../../middleware/authenticate.mjs";import c from"../../middleware/permissions.mjs";import l from"../../middleware/validate.mjs";import u from"../../openapi/index.mjs";import d from"../../utils/build-response.mjs";import f from"zod";import{createFactory as p}from"hono/factory";import{describeRoute as m}from"hono-openapi";const h=p().createHandlers(m({description:`Returns a single email based on the the ID.`,tags:[`emails`],summary:`Get Email`,responses:u.responses({schema:f.toJSONSchema(n.getSingle.response)}),parameters:u.parameters({params:n.getSingle.params})}),s(),c([o.EmailRead]),l(`param`,n.getSingle.params),async n=>{let{id:o}=n.req.valid(`param`),s=r(n),c=await a(i,{transaction:!1,defaultError:{type:`basic`,name:e(`server:core.routes.email.fetch.error.name`),message:e(`server:core.routes.email.fetch.error.message`)}})(s,{id:Number.parseInt(o,10),renderTemplate:!0});if(c.error)throw new t(c.error);return n.status(200),n.json(d(n,{data:c.data}))});export{h as default};
//# sourceMappingURL=get-single.mjs.map