Browse Source

fix: correction in sample payload

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1917/head
Pranav C 3 years ago
parent
commit
66c089e2d7
  1. 11
      packages/nocodb/src/lib/noco/meta/helpers/populateSamplePayload.ts

11
packages/nocodb/src/lib/noco/meta/helpers/populateSamplePayload.ts

@ -33,6 +33,14 @@ export default async function populateSamplePayload(
[UITypes.LinkToAnotherRecord, UITypes.Lookup].includes(column.uidt)
)
continue;
if (
operation === 'update' &&
[UITypes.LinkToAnotherRecord, UITypes.Lookup].includes(column.uidt)
) {
continue;
}
if (operation === 'delete' && model.primaryKey?.title !== column.title)
continue;
@ -55,6 +63,9 @@ async function getSampleColumnValue(column: Column): Promise<any> {
const sampleVal = await populateSamplePayload(
await colOpt.getRelatedTable()
);
if (colOpt.type !== RelationTypes.BELONGS_TO) {
return undefined;
}
return colOpt.type === RelationTypes.BELONGS_TO
? sampleVal
: [sampleVal];

Loading…
Cancel
Save