From 8611b53a620018bf395378fa46a361f0ce8edc15 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 15 Jun 2023 01:29:15 +0530 Subject: [PATCH] fix: pass values as array Signed-off-by: Pranav C --- packages/nocodb/src/db/BaseModelSqlv2.ts | 6 +++--- packages/nocodb/src/services/data-table.service.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index c324f796a1..e73528f4fe 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3491,7 +3491,7 @@ class BaseModelSqlv2 { rowId, }: { cookie: any; - childIds: (string|number)[]; + childIds: (string | number)[]; colId: string; rowId: string; }) { @@ -3599,7 +3599,7 @@ class BaseModelSqlv2 { rowId, }: { cookie: any; - childIds: (string|number)[]; + childIds: (string | number)[]; colId: string; rowId: string; }) { @@ -3636,7 +3636,7 @@ class BaseModelSqlv2 { .where({ [vParentCol.column_name]: this.dbDriver(parentTn) .select(parentColumn.column_name) - .whereIn(parentTable.primaryKey.column_name,childIds) + .whereIn(parentTable.primaryKey.column_name, childIds) .first(), [vChildCol.column_name]: this.dbDriver(childTn) .select(childColumn.column_name) diff --git a/packages/nocodb/src/services/data-table.service.ts b/packages/nocodb/src/services/data-table.service.ts index ddfb72efde..be733a49a5 100644 --- a/packages/nocodb/src/services/data-table.service.ts +++ b/packages/nocodb/src/services/data-table.service.ts @@ -317,7 +317,7 @@ export class DataTableService { await baseModel.addLinks({ colId: column.id, - childIds: param.refRowIds, + childIds: Array.isArray(param.refRowIds) ? param.refRowIds : [param.refRowIds], rowId: param.rowId, cookie: param.cookie, }); @@ -340,7 +340,7 @@ export class DataTableService { await baseModel.removeLinks({ colId: column.id, - childIds: param.refRowIds, + childIds: Array.isArray(param.refRowIds) ? param.refRowIds : [param.refRowIds], rowId: param.rowId, cookie: param.cookie, });