@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.22 kB
JavaScript
import e from"./parents/static-repository.mjs";import t from"zod";var n=class extends e{constructor(e,t){super(e,t,`lucid_role_translations`)}tableSchema=t.object({id:t.number(),role_id:t.number(),locale_code:t.string(),name:t.string().nullable(),description:t.string().nullable()});columnFormats={id:this.dbAdapter.getDataType(`primary`),role_id:this.dbAdapter.getDataType(`integer`),locale_code:this.dbAdapter.getDataType(`text`),name:this.dbAdapter.getDataType(`text`),description:this.dbAdapter.getDataType(`text`)};queryConfig=void 0;async upsertMultiple(e){let t=this.db.insertInto(`lucid_role_translations`).values(e.data.map(e=>this.formatData(e,{type:`insert`}))).onConflict(e=>e.columns([`role_id`,`locale_code`]).doUpdateSet(e=>({name:e.ref(`excluded.name`),description:e.ref(`excluded.description`)}))).$if(e.returnAll!==!0&&e.returning!==void 0&&e.returning.length>0,t=>t.returning(e.returning)).$if(e.returnAll??!1,e=>e.returningAll()),n=await this.executeQuery(()=>t.execute(),{method:`upsertMultiple`});return n.response.error?n.response:this.validateResponse(n,{...e.validation,mode:`multiple`,select:e.returning,selectAll:e.returnAll})}};export{n as default};
//# sourceMappingURL=role-translations.mjs.map