UNPKG

@lucidcms/core

Version:

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

2 lines 792 B
import{copy as e}from"../../libs/i18n/copy.mjs";import t from"../../libs/repositories/roles.mjs";import{invalidateAuthCache as n}from"../auth/helpers/auth-cache.mjs";import r from"./checks/check-role-access.mjs";import i from"../../libs/formatters/index.mjs";const a=async(a,o)=>{let s=new t(a.db.client,a.config.db),c=await r(a,{id:o.id});if(c.error)return c;if(i.formatBoolean(c.data.locked))return{error:{type:`basic`,message:e(`server:core.permissions.denied`),status:403},data:void 0};let l=await s.deleteMultiple({where:[{key:`id`,operator:`=`,value:o.id}],returning:[`id`],validation:{enabled:!0}});return l.error?l:l.data.length===0?{error:{type:`basic`,status:500},data:void 0}:(await n(a),{error:void 0,data:void 0})};export{a as default}; //# sourceMappingURL=delete-single.mjs.map