From bc77bf363a59b8bf418c77315d40584df23406e6 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 30 Mar 2023 21:00:09 +0800 Subject: [PATCH] feat(nocodb): trigger hooks for LTAR add/remove child --- .../src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index fb755d0c09..182cbb66de 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -2676,6 +2676,8 @@ class BaseModelSqlv2 { break; } + const response = await this.readByPk(rowId); + await this.afterInsert(response, this.dbDriver, cookie); await this.afterAddChild(rowId, childId, cookie); } @@ -2723,6 +2725,8 @@ class BaseModelSqlv2 { const childTn = this.getTnPath(childTable); const parentTn = this.getTnPath(parentTable); + const prevData = await this.readByPk(rowId); + switch (colOptions.type) { case RelationTypes.MANY_TO_MANY: { @@ -2774,6 +2778,8 @@ class BaseModelSqlv2 { break; } + const newData = await this.readByPk(rowId); + await this.afterUpdate(prevData, newData, this.dbDriver, cookie); await this.afterRemoveChild(rowId, childId, cookie); }