Browse Source

fixed PR comments

pull/6878/head
Aashish Agrawal 1 year ago
parent
commit
888b6e693c
  1. 29
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -2178,20 +2178,6 @@ class BaseModelSqlv2 {
async insert(data, trx?, cookie?, _disableOptimization = false) { async insert(data, trx?, cookie?, _disableOptimization = false) {
try { try {
await populatePk(this.model, data);
// todo: filter based on view
const insertObj = await this.model.mapAliasToColumn(
data,
this.clientMeta,
this.dbDriver,
);
await this.validate(insertObj);
if ('beforeInsert' in this) {
await this.beforeInsert(insertObj, trx, cookie);
}
const columns = await this.model.getColumns(); const columns = await this.model.getColumns();
@ -2204,9 +2190,24 @@ class BaseModelSqlv2 {
if (data[keyName]) { if (data[keyName]) {
delete data[keyName]; delete data[keyName];
} }
} }
} }
await populatePk(this.model, data);
// todo: filter based on view
const insertObj = await this.model.mapAliasToColumn(
data,
this.clientMeta,
this.dbDriver,
);
await this.validate(insertObj);
if ('beforeInsert' in this) {
await this.beforeInsert(insertObj, trx, cookie);
}
await this.prepareAttachmentData(insertObj); await this.prepareAttachmentData(insertObj);
let response; let response;

Loading…
Cancel
Save