Browse Source

refactor(nocodb): lint

pull/6878/head
աɨռɢӄաօռɢ 1 year ago
parent
commit
1370356edc
  1. 16
      packages/nocodb/src/db/BaseModelSqlv2.ts

16
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -2193,18 +2193,16 @@ class BaseModelSqlv2 {
await this.beforeInsert(insertObj, trx, cookie);
}
const columns = await this.model.getColumns();
const columns = await this.model.getColumns();
//remove auto increment columns if present in body
// exclude auto increment columns in body
for (const col of columns) {
if (col.ai == true) {
const keyName = data?.[col.column_name] !== undefined
? col.column_name
: col.title
if (col.ai === true) {
const keyName =
data?.[col.column_name] !== undefined ? col.column_name : col.title;
if (data[keyName]) {
delete data[keyName]
delete data[keyName];
}
}
}
@ -2225,7 +2223,7 @@ class BaseModelSqlv2 {
const ai = this.model.columns.find((c) => c.ai);
let ag: Column;
if (!ai) ag = this.model.columns.find((c) => c.meta?.ag);
if (!ai) ag = this.model.columns.find((c) => c.meta?.ag);
// handle if autogenerated primary key is used
if (ag) {

Loading…
Cancel
Save