Browse Source

fix: handle id value properly

pull/9348/head
Pranav C 3 months ago
parent
commit
b117663856
  1. 18
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -6472,7 +6472,7 @@ class BaseModelSqlv2 {
return pkValues; return pkValues;
} else if (this.model.primaryKey) { } else if (this.model.primaryKey) {
return ( return (
data[this.model.primaryKey.title] || data[this.model.primaryKey.title] ??
data[this.model.primaryKey.column_name] data[this.model.primaryKey.column_name]
); );
} else { } else {
@ -8747,7 +8747,7 @@ class BaseModelSqlv2 {
typeof childIds[0] === 'object' typeof childIds[0] === 'object'
? childIds.map( ? childIds.map(
(c) => (c) =>
c[parentTable.primaryKey.title] || c[parentTable.primaryKey.title] ??
c[parentTable.primaryKey.column_name], c[parentTable.primaryKey.column_name],
) )
: childIds, : childIds,
@ -8830,7 +8830,7 @@ class BaseModelSqlv2 {
typeof childIds[0] === 'object' typeof childIds[0] === 'object'
? childIds.map( ? childIds.map(
(c) => (c) =>
c[parentTable.primaryKey.title] || c[parentTable.primaryKey.title] ??
c[parentTable.primaryKey.column_name], c[parentTable.primaryKey.column_name],
) )
: childIds, : childIds,
@ -8871,7 +8871,7 @@ class BaseModelSqlv2 {
typeof childIds[0] === 'object' typeof childIds[0] === 'object'
? childIds.map( ? childIds.map(
(c) => (c) =>
c[childTable.primaryKey.title] || c[childTable.primaryKey.title] ??
c[childTable.primaryKey.column_name], c[childTable.primaryKey.column_name],
) )
: childIds, : childIds,
@ -9113,7 +9113,7 @@ class BaseModelSqlv2 {
(r) => (r) =>
r[parentColumn.column_name] === r[parentColumn.column_name] ===
(typeof id === 'object' (typeof id === 'object'
? id[parentTable.primaryKey.title] || ? id[parentTable.primaryKey.title] ??
id[parentTable.primaryKey.column_name] id[parentTable.primaryKey.column_name]
: id), : id),
), ),
@ -9139,7 +9139,7 @@ class BaseModelSqlv2 {
typeof childIds[0] === 'object' typeof childIds[0] === 'object'
? childIds.map( ? childIds.map(
(c) => (c) =>
c[parentTable.primaryKey.title] || c[parentTable.primaryKey.title] ??
c[parentTable.primaryKey.column_name], c[parentTable.primaryKey.column_name],
) )
: childIds, : childIds,
@ -9182,7 +9182,7 @@ class BaseModelSqlv2 {
parentTable.primaryKey.column_name, parentTable.primaryKey.column_name,
childIds.map( childIds.map(
(c) => (c) =>
c[parentTable.primaryKey.title] || c[parentTable.primaryKey.title] ??
c[parentTable.primaryKey.column_name], c[parentTable.primaryKey.column_name],
), ),
); );
@ -9201,7 +9201,7 @@ class BaseModelSqlv2 {
(r) => (r) =>
r[parentColumn.column_name] === r[parentColumn.column_name] ===
(typeof id === 'object' (typeof id === 'object'
? id[parentTable.primaryKey.title] || ? id[parentTable.primaryKey.title] ??
id[parentTable.primaryKey.column_name] id[parentTable.primaryKey.column_name]
: id), : id),
), ),
@ -9225,7 +9225,7 @@ class BaseModelSqlv2 {
typeof childIds[0] === 'object' typeof childIds[0] === 'object'
? childIds.map( ? childIds.map(
(c) => (c) =>
c[parentTable.primaryKey.title] || c[parentTable.primaryKey.title] ??
c[parentTable.primaryKey.column_name], c[parentTable.primaryKey.column_name],
) )
: childIds, : childIds,

Loading…
Cancel
Save