Browse Source

fix: new data api links correction

pull/6817/head
Pranav C 1 year ago
parent
commit
210aedbadf
  1. 28
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -4576,20 +4576,20 @@ class BaseModelSqlv2 {
break; break;
} }
const response = await this.readByPk( const updatedRow = await this.readByPk(
rowId, rowId,
false, false,
{}, {},
{ ignoreView: true, getHiddenColumn: true }, { ignoreView: true, getHiddenColumn: true },
); );
await this.afterUpdate(row, response, this.dbDriver, cookie); await this.afterUpdate(row, updatedRow, this.dbDriver, cookie);
for (const childId of childIds) { for (const childId of childIds) {
await this.afterAddChild(rowId, childId, cookie); await this.afterAddChild(rowId, childId, cookie);
} }
} }
async removeLinks({ async removeLinks({
cookie: _cookie, cookie,
childIds, childIds,
colId, colId,
rowId, rowId,
@ -4605,9 +4605,12 @@ class BaseModelSqlv2 {
if (!column || !isLinksOrLTAR(column)) if (!column || !isLinksOrLTAR(column))
NcError.notFound(`Link column ${colId} not found`); NcError.notFound(`Link column ${colId} not found`);
const row = await this.dbDriver(this.tnPath) const row = await this.readByPk(
.where(await this._wherePk(rowId)) rowId,
.first(); false,
{},
{ ignoreView: true, getHiddenColumn: true },
);
// validate rowId // validate rowId
if (!row) { if (!row) {
@ -4786,9 +4789,16 @@ class BaseModelSqlv2 {
break; break;
} }
// const newData = await this.readByPk(rowId); const updatedRow = await this.readByPk(
// await this.afterUpdate(prevData, newData, this.dbDriver, cookie); rowId,
// await this.afterRemoveChild(rowId, childIds, cookie); false,
{},
{ ignoreView: true, getHiddenColumn: true },
);
await this.afterUpdate(row, updatedRow, this.dbDriver, cookie);
for (const childId of childIds) {
await this.afterRemoveChild(rowId, childId, cookie);
}
} }
async btRead( async btRead(

Loading…
Cancel
Save