UNPKG

@lucidcms/core

Version:

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

2 lines 858 B
import{copy as e}from"../../libs/i18n/copy.mjs";import t from"../../utils/helpers/get-base-url.mjs";import n from"../../libs/repositories/users.mjs";import r from"../../libs/formatters/users.mjs";const i=async(i,a)=>{let o=new n(i.db.client,i.config.db),s=[{key:`id`,operator:`=`,value:a.userId}];a.activeUser&&s.push({key:`is_deleted`,operator:`=`,value:i.config.db.getDefault(`boolean`,`false`)});let c=await o.selectSinglePreset({tenantKey:i.request.tenantKey,where:s,validation:{enabled:!0,defaultError:{message:e(`server:core.user.not.found.message`),status:404}}});return c.error?c:{error:void 0,data:r.formatSingle({user:c.data,authUser:a.authUser,host:t(i),locales:i.config.localization.locales.map(e=>e.code),defaultLocale:i.config.localization.defaultLocale,tenants:i.config.tenants})}};export{i as default}; //# sourceMappingURL=get-single.mjs.map