UNPKG

@lucidcms/core

Version:

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

2 lines 895 B
import{copy as e}from"../../libs/i18n/copy.mjs";import t from"../../libs/repositories/locales.mjs";import n from"../../libs/formatters/locales.mjs";const r=async(r,i)=>{let a=new t(r.db.client,r.config.db),o=r.config.localization.locales.find(e=>e.code===i.code);if(!o)return{error:{type:`basic`,message:e(`server:core.locale.not.found.message`),status:404},data:void 0};let s=await a.selectSingle({select:[`code`,`created_at`,`updated_at`,`is_deleted`,`is_deleted_at`],where:[{key:`code`,operator:`=`,value:i.code},{key:`is_deleted`,operator:`!=`,value:r.config.db.getDefault(`boolean`,`true`)}],validation:{enabled:!0,defaultError:{message:e(`server:core.locale.not.found.message`),status:404}}});return s.error?s:{error:void 0,data:n.formatSingle({locale:s.data,configLocale:o,defaultLocale:r.config.localization.defaultLocale})}};export{r as default}; //# sourceMappingURL=get-single.mjs.map