@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 946 B
JavaScript
import e from"../../libs/repositories/security-audit-logs.mjs";import t from"../../libs/repositories/users.mjs";import n from"../../utils/security-audit/sort-role-snapshot.mjs";import r from"../../libs/formatters/index.mjs";const i=async(i,a)=>{let o=new t(i.db.client,i.config.db),s=new e(i.db.client,i.config.db),c=await o.selectAuditActorById({id:a.performedBy,defaultLocale:i.config.localization.defaultLocale,validation:{enabled:!0}});if(c.error)return c;let l=await s.createSingle({data:{user_id:a.userId,action:a.action,performed_by:a.performedBy,performed_by_roles:n(c.data.roles?.map(e=>({id:e.id,name:e.name??``}))??[]),performed_by_super_admin:r.formatBoolean(c.data.super_admin),ip_address:i.request.ipAddress??`unknown`,previous_value:a.previousValue,new_value:a.newValue},returning:[`id`],validation:{enabled:!0}});return l.error?l:{error:void 0,data:l.data.id}};export{i as default};
//# sourceMappingURL=log-security-audit.mjs.map