UNPKG

@lucidcms/core

Version:

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

2 lines 787 B
import e from"../../../libs/repositories/users.mjs";import{invalidateAuthCache as t}from"../../auth/helpers/auth-cache.mjs";import n from"../checks/check-not-last-user.mjs";import r from"../checks/check-user-access.mjs";import i from"../../../libs/formatters/index.mjs";const a=async(a,o)=>{let s=new e(a.db.client,a.config.db),c=await r(a,{id:o.id});if(c.error)return c;let l=await s.selectSingle({select:[`id`,`is_deleted`],where:[{key:`id`,operator:`=`,value:o.id}],validation:{enabled:!0}});if(l.error)return l;if(!i.formatBoolean(l.data.is_deleted)){let e=await n(a);if(e.error)return e}let u=await s.deleteSingle({where:[{key:`id`,operator:`=`,value:o.id}]});return u.error?u:(await t(a),{error:void 0,data:void 0})};export{a as default}; //# sourceMappingURL=delete-single.mjs.map