From 801f35b2772fcb91416cf13cc7d32b3dd6fe60bb Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 22 Jul 2023 11:53:43 +0530 Subject: [PATCH] fix: include all fields in webhook payload regardless of view Signed-off-by: Pranav C --- packages/nocodb/src/db/BaseModelSqlv2.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index f39079c2fd..c31d9acba2 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -149,13 +149,18 @@ class BaseModelSqlv2 { id?: any, validateFormula = false, query: any = {}, + { + ignoreView = false, + }: { + ignoreView?: boolean; + } = {}, ): Promise { const qb = this.dbDriver(this.tnPath); const { ast, dependencyFields } = await getAst({ query, model: this.model, - view: this.viewId && (await View.get(this.viewId)), + view: ignoreView ? null : this.viewId && (await View.get(this.viewId)), }); await this.selectObject({ @@ -2018,7 +2023,7 @@ class BaseModelSqlv2 { await this.beforeUpdate(data, trx, cookie); - const prevData = await this.readByPk(id); + const prevData = await this.readByPk(id, false, {}, { ignoreView: true }); const query = this.dbDriver(this.tnPath) .update(updateObj) @@ -2026,7 +2031,7 @@ class BaseModelSqlv2 { await this.execAndParse(query); - const newData = await this.readByPk(id); + const newData = await this.readByPk(id, false, {}, { ignoreView: true }); await this.afterUpdate(prevData, newData, trx, cookie, updateObj); return newData; } catch (e) {