From 86fade00f1c523727cb08a373985798bf4b9fe61 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 5 Jul 2024 08:35:41 +0000 Subject: [PATCH] fix: ai pr review changes --- packages/nocodb/src/db/BaseModelSqlv2.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 87faf0718c..d6f3f4374f 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3703,9 +3703,10 @@ class BaseModelSqlv2 { await this.prepareNocoData(updateObj, false, cookie); - const btForeignKeyColumn = columns - .filter((c) => c.uidt === UITypes.ForeignKey) - .find((c) => data[c.column_name] !== undefined); + const btForeignKeyColumn = columns.find( + (c) => + c.uidt === UITypes.ForeignKey && data[c.column_name] !== undefined, + ); const btColumn = btForeignKeyColumn ? columns.find( @@ -5468,7 +5469,7 @@ class BaseModelSqlv2 { const auditConfig = { childModel: childTable, parentModel: parentTable, - childColTitle: relatedChildCol.title || '', + childColTitle: relatedChildCol?.title || '', parentColTitle: column.title, } as { childModel: Model; @@ -6151,7 +6152,7 @@ class BaseModelSqlv2 { const auditConfig = { childModel: childTable, parentModel: parentTable, - childColTitle: relatedChildCol.title || '', + childColTitle: relatedChildCol?.title || '', parentColTitle: column.title, } as { childModel: Model; @@ -7240,7 +7241,7 @@ class BaseModelSqlv2 { const auditConfig = { childModel: childTable, parentModel: parentTable, - childColTitle: relatedChildCol.title || '', + childColTitle: relatedChildCol?.title || '', parentColTitle: column.title, } as { childModel: Model; @@ -7609,7 +7610,7 @@ class BaseModelSqlv2 { const auditConfig = { childModel: childTable, parentModel: parentTable, - childColTitle: relatedChildCol.title || '', + childColTitle: relatedChildCol?.title || '', parentColTitle: column.title, } as { childModel: Model; @@ -8613,7 +8614,7 @@ function getRelatedLinksColumn( relatedModel: Model, ) { return relatedModel.columns.find((c: Column) => { - if (column.colOptions.type === RelationTypes.MANY_TO_MANY) { + if (column.colOptions?.type === RelationTypes.MANY_TO_MANY) { return ( column.colOptions.fk_mm_child_column_id === c.colOptions?.fk_mm_parent_column_id &&