Browse Source

fix: include all fields with update and delete webhook data

re #6246

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6287/head
Pranav C 1 year ago
parent
commit
41bf2400d2
  1. 1619
      packages/nocodb/package-lock.json
  2. 2
      packages/nocodb/package.json
  3. 26
      packages/nocodb/src/db/BaseModelSqlv2.ts

1619
packages/nocodb/package-lock.json generated

File diff suppressed because it is too large Load Diff

2
packages/nocodb/package.json

@ -125,7 +125,7 @@
"multer": "^1.4.4", "multer": "^1.4.4",
"mysql2": "^3.2.0", "mysql2": "^3.2.0",
"nanoid": "^3.1.20", "nanoid": "^3.1.20",
"nc-help": "^0.2.87", "nc-help": "0.2.92",
"nc-lib-gui": "0.111.0", "nc-lib-gui": "0.111.0",
"nc-plugin": "^0.1.3", "nc-plugin": "^0.1.3",
"ncp": "^2.0.0", "ncp": "^2.0.0",

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

@ -2176,7 +2176,7 @@ class BaseModelSqlv2 {
return res; return res;
} }
async updateByPk(id, data, trx?, cookie?, disableOptimization = false) { async updateByPk(id, data, trx?, cookie?, _disableOptimization = false) {
try { try {
const updateObj = await this.model.mapAliasToColumn( const updateObj = await this.model.mapAliasToColumn(
data, data,
@ -2679,7 +2679,15 @@ class BaseModelSqlv2 {
// pk not specified - bypass // pk not specified - bypass
continue; continue;
} }
if (!raw) prevData.push(await this.readByPk(pkValues)); if (!raw)
prevData.push(
await this.readByPk(
pkValues,
false,
{},
{ ignoreView: true, getHiddenColumn: true },
),
);
const wherePk = await this._wherePk(pkValues); const wherePk = await this._wherePk(pkValues);
res.push(wherePk); res.push(wherePk);
toBeUpdated.push({ d, wherePk }); toBeUpdated.push({ d, wherePk });
@ -2696,7 +2704,12 @@ class BaseModelSqlv2 {
if (!raw) { if (!raw) {
for (const pkValues of updatePkValues) { for (const pkValues of updatePkValues) {
const oldRecord = await this.readByPk(pkValues); const oldRecord = await this.readByPk(
pkValues,
false,
{},
{ ignoreView: true, getHiddenColumn: true },
);
if (!oldRecord && throwExceptionIfNotExist) if (!oldRecord && throwExceptionIfNotExist)
NcError.unprocessableEntity( NcError.unprocessableEntity(
`Record with pk ${JSON.stringify(pkValues)} not found`, `Record with pk ${JSON.stringify(pkValues)} not found`,
@ -2800,7 +2813,12 @@ class BaseModelSqlv2 {
continue; continue;
} }
const oldRecord = await this.readByPk(pkValues); const oldRecord = await this.readByPk(
pkValues,
false,
{},
{ ignoreView: true, getHiddenColumn: true },
);
if (!oldRecord && throwExceptionIfNotExist) if (!oldRecord && throwExceptionIfNotExist)
NcError.unprocessableEntity( NcError.unprocessableEntity(
`Record with pk ${JSON.stringify(pkValues)} not found`, `Record with pk ${JSON.stringify(pkValues)} not found`,

Loading…
Cancel
Save