@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.78 kB
JavaScript
import{copy as e}from"../../../i18n/copy.mjs";import t from"../../../../constants/constants.mjs";import n from"../../../../utils/errors/lucid-api-error.mjs";import{controllerSchemas as r}from"../../../../schemas/email.mjs";import i from"../../utils/create-service-context.mjs";import a from"../../../../services/email/resend-single.mjs";import o from"../../../../utils/services/service-wrapper.mjs";import{Permissions as s}from"../../../permission/definitions.mjs";import c from"../../middleware/authenticate.mjs";import l from"../../middleware/permissions.mjs";import u from"../../middleware/rate-limiter.mjs";import d from"../../middleware/validate.mjs";import f from"../../middleware/validate-csrf.mjs";import p from"../../openapi/index.mjs";import m from"../../utils/build-response.mjs";import h from"zod";import{minutesToMilliseconds as g}from"date-fns";import{createFactory as _}from"hono/factory";import{describeRoute as v}from"hono-openapi";const y=_().createHandlers(v({description:`Resends the email with the given ID.`,tags:[`emails`],summary:`Resend Email`,responses:p.responses({schema:h.toJSONSchema(r.resendSingle.response)}),parameters:p.parameters({params:r.resendSingle.params,headers:{csrf:!0}})}),f,c(),u({mode:`user`,limit:t.rateLimit.scopes.sensitive.limit,scope:t.rateLimit.scopes.sensitive.scopeKey,windowMs:g(1)}),l([s.EmailSend]),d(`param`,r.resendSingle.params),async t=>{let{id:r}=t.req.valid(`param`),s=i(t),c=await o(a,{transaction:!0,defaultError:{type:`basic`,name:e(`server:core.routes.email.resend.error.name`),message:e(`server:core.routes.email.resend.error.message`)}})(s,{id:Number.parseInt(r,10)});if(c.error)throw new n(c.error);return t.status(200),t.json(m(t,{data:c.data}))});export{y as default};
//# sourceMappingURL=resend-single.mjs.map