@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.21 kB
JavaScript
import e from"../db/query-builder/index.mjs";import t from"./parents/static-repository.mjs";import n from"zod";var r=class extends t{constructor(e,t){super(e,t,`lucid_user_roles`)}tableSchema=n.object({id:n.number(),user_id:n.number(),role_id:n.number(),updated_at:n.union([n.string(),n.date()]).nullable(),created_at:n.union([n.string(),n.date()]).nullable()});columnFormats={id:this.dbAdapter.getDataType(`primary`),user_id:this.dbAdapter.getDataType(`integer`),role_id:this.dbAdapter.getDataType(`integer`),updated_at:this.dbAdapter.getDataType(`timestamp`),created_at:this.dbAdapter.getDataType(`timestamp`)};queryConfig=void 0;async deleteMultipleByUserTenantScope(t){let n=this.db.deleteFrom(`lucid_user_roles`).where(`user_id`,`=`,t.userId).returning([`id`]);if(t.tenantKey!=null){let r=this.db.selectFrom(`lucid_roles`).select(`id`).$call(n=>e.tenantScope(n,{tenantKey:t.tenantKey,column:`lucid_roles.tenant_key`}));n=n.where(`role_id`,`in`,r)}let r=await this.executeQuery(()=>n.execute(),{method:`deleteMultipleByUserTenantScope`});return r.response.error?r.response:this.validateResponse(r,{...t.validation,mode:`multiple`,select:[`id`]})}};export{r as default};
//# sourceMappingURL=user-roles.mjs.map