Browse Source

feat(nocodb): trigger hooks for LTAR add/remove child

pull/5349/head
Wing-Kam Wong 2 years ago
parent
commit
bc77bf363a
  1. 6
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

6
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -2676,6 +2676,8 @@ class BaseModelSqlv2 {
break; break;
} }
const response = await this.readByPk(rowId);
await this.afterInsert(response, this.dbDriver, cookie);
await this.afterAddChild(rowId, childId, cookie); await this.afterAddChild(rowId, childId, cookie);
} }
@ -2723,6 +2725,8 @@ class BaseModelSqlv2 {
const childTn = this.getTnPath(childTable); const childTn = this.getTnPath(childTable);
const parentTn = this.getTnPath(parentTable); const parentTn = this.getTnPath(parentTable);
const prevData = await this.readByPk(rowId);
switch (colOptions.type) { switch (colOptions.type) {
case RelationTypes.MANY_TO_MANY: case RelationTypes.MANY_TO_MANY:
{ {
@ -2774,6 +2778,8 @@ class BaseModelSqlv2 {
break; break;
} }
const newData = await this.readByPk(rowId);
await this.afterUpdate(prevData, newData, this.dbDriver, cookie);
await this.afterRemoveChild(rowId, childId, cookie); await this.afterRemoveChild(rowId, childId, cookie);
} }

Loading…
Cancel
Save