From 5683f4b4d27ee09d7a61c69fd6640294596de628 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 12 Apr 2022 11:37:40 +0530 Subject: [PATCH] refactor: data update api correction Signed-off-by: Pranav C --- .../project/spreadsheet/rowsXcDataTable.vue | 15 +++++++++------ .../lib/noco/meta/api/dataApis/dataAliasApis.ts | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index d4efdd8036..15c3814764 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -1115,14 +1115,17 @@ export default { this.$set(this.data[row], 'saving', true) // eslint-disable-next-line promise/param-names - const newData = (await this.$api.data.update(this.meta.id, id, { - [column.title]: rowObj[column.title] - }, { - query: { ignoreWebhook: !saved } - }))// { [column.title]: oldRow[column.title] }) + const newData = (await this.$api.dbTableRow.update( + 'noco', + this.projectName, + this.meta.title, id, { + [column.title]: rowObj[column.title] + }, { + query: { ignoreWebhook: !saved } + })) // audit - this.$api.utils.auditRowUpdate({ + this.$api.utils.auditRowUpdate(id, { fk_model_id: this.meta.id, column_name: column.title, row_id: id, diff --git a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts index 783741d76a..4feba487e1 100644 --- a/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/dataApis/dataAliasApis.ts @@ -33,7 +33,7 @@ async function dataUpdate(req: Request, res: Response) { const baseModel = await Model.getBaseModelSQL({ id: model.id, - viewId: view.id, + viewId: view?.id, dbDriver: NcConnectionMgrv2.get(base) }); @@ -45,7 +45,7 @@ async function dataDelete(req: Request, res: Response) { const base = await Base.get(model.base_id); const baseModel = await Model.getBaseModelSQL({ id: model.id, - viewId: view.id, + viewId: view?.id, dbDriver: NcConnectionMgrv2.get(base) });