@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.23 kB
JavaScript
import{copy as e}from"../../../i18n/copy.mjs";import t from"../../../../utils/errors/lucid-api-error.mjs";import n from"../../../../services/account/get-authenticated-user.mjs";import r from"../../utils/create-service-context.mjs";import i from"../../../../utils/services/service-wrapper.mjs";import a from"../../middleware/authenticate.mjs";import o from"../../openapi/index.mjs";import s from"../../utils/build-response.mjs";import{controllerSchemas as c}from"../../../../schemas/account.mjs";import l from"zod";import{createFactory as u}from"hono/factory";import{describeRoute as d}from"hono-openapi";const f=u().createHandlers(d({description:`Returns the authenticated user based on the access token.`,tags:[`account`],summary:`Get Authenticated User`,responses:o.responses({schema:l.toJSONSchema(c.getMe.response)})}),a({tenantScope:`allow-global`}),async a=>{let o=r(a),c=await i(n,{transaction:!1,defaultError:{type:`basic`,name:e(`server:core.routes.user.fetch.error.name`),message:e(`server:core.routes.user.fetch.error.message`)}})(o,{userId:a.get(`auth`).id,authUser:a.get(`auth`)});if(c.error)throw new t(c.error);return a.status(200),a.json(s(a,{data:c.data}))});export{f as default};
//# sourceMappingURL=get-me.mjs.map