From c04acbfe76c7f1a98fe0fe1814f438c3651d3781 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Thu, 28 Nov 2024 10:41:20 +0000 Subject: [PATCH] fix: bulkupsert endpoint --- packages/nocodb/src/db/BaseModelSqlv2.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 1fb785e6ef..35aecae66b 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -5332,10 +5332,6 @@ class BaseModelSqlv2 { const dataWithoutPks = []; for (const data of preparedDatas) { - if (!raw) { - await this.prepareNocoData(data, true, cookie); - } - const pkValues = this.extractPksValues(data); if (pkValues !== 'N/A' && pkValues !== undefined) { dataWithPks.push({ pk: pkValues, data }); @@ -5366,6 +5362,9 @@ class BaseModelSqlv2 { } } + await Promise.all(toInsert.map((d) => this.prepareNocoData(d, true, cookie))) + await Promise.all(toUpdate.map((d) => this.prepareNocoData(d, false, cookie))) + trx = await this.dbDriver.transaction(); const updatedPks = [];