Browse Source

fix: if non-object value passed in Links/LTAR column ignore while inserting

pull/6817/head
Pranav C 1 year ago
parent
commit
07d23b2ee0
  1. 3
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -2635,6 +2635,7 @@ class BaseModelSqlv2 {
switch (colOptions.type) {
case RelationTypes.BELONGS_TO:
{
if (typeof nestedData !== 'object') continue;
const childCol = await colOptions.getChildColumn();
const parentCol = await colOptions.getParentColumn();
insertObj[childCol.column_name] = nestedData?.[parentCol.title];
@ -2642,6 +2643,7 @@ class BaseModelSqlv2 {
break;
case RelationTypes.HAS_MANY:
{
if (!Array.isArray(nestedData)) continue;
const childCol = await colOptions.getChildColumn();
const childModel = await childCol.getModel();
await childModel.getColumns();
@ -2665,6 +2667,7 @@ class BaseModelSqlv2 {
}
break;
case RelationTypes.MANY_TO_MANY: {
if (!Array.isArray(nestedData)) continue;
postInsertOps.push(
async (
rowId,

Loading…
Cancel
Save