UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 1.24 kB
import{copy as e}from"../../../i18n/copy.mjs";import t from"../../../../utils/errors/lucid-api-error.mjs";import n from"../../utils/create-service-context.mjs";import r from"../../../../utils/services/service-wrapper.mjs";import i from"../../../../services/tenants/get-all.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/tenants.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 all tenants the authenticated user has access to. Empty when multi-tenancy is not enabled.`,tags:[`tenants`],summary:`Get All Tenants`,responses:o.responses({schema:l.toJSONSchema(c.getAll.response)})}),a({tenantScope:`allow-global`}),async a=>{let o=n(a),c=await r(i,{transaction:!1,defaultError:{type:`basic`,name:e(`server:core.routes.tenants.fetch.error.name`),message:e(`server:core.routes.tenants.fetch.error.message`)}})(o,{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-all.mjs.map