Browse Source

fix: use insert hook for update hook for link method

pull/6817/head
Pranav C 1 year ago
parent
commit
b7c9553aa2
  1. 10
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -2524,7 +2524,7 @@ class BaseModelSqlv2 {
? JSON.parse(data[col.title]) ? JSON.parse(data[col.title])
: data[col.title]; : data[col.title];
} catch { } catch {
continue continue;
} }
switch (colOptions.type) { switch (colOptions.type) {
case RelationTypes.BELONGS_TO: case RelationTypes.BELONGS_TO:
@ -3581,6 +3581,12 @@ 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,
false,
{},
{ ignoreView: true, getHiddenColumn: true },
);
switch (colOptions.type) { switch (colOptions.type) {
case RelationTypes.MANY_TO_MANY: case RelationTypes.MANY_TO_MANY:
@ -3658,7 +3664,7 @@ class BaseModelSqlv2 {
{}, {},
{ ignoreView: true, getHiddenColumn: true }, { ignoreView: true, getHiddenColumn: true },
); );
await this.afterInsert(response, this.dbDriver, cookie); await this.afterUpdate(prevData, response, this.dbDriver, cookie);
await this.afterAddChild(rowId, childId, cookie); await this.afterAddChild(rowId, childId, cookie);
} }

Loading…
Cancel
Save