Browse Source

fix: add missing validation for checking null value

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/1556/head
Wing-Kam Wong 3 years ago
parent
commit
3e914d3228
  1. 8
      packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue

8
packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue

@ -151,6 +151,14 @@ export default {
if ((this.mappings || []).filter(v => v.destCn === _cn).length > 1) { return 'Duplicate mapping found, please remove one of the mapping' } if ((this.mappings || []).filter(v => v.destCn === _cn).length > 1) { return 'Duplicate mapping found, please remove one of the mapping' }
// check if the input contains null value for a required column
if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) {
if (this.parsedCsv && this.parsedCsv.data && this.parsedCsv.data.slice(0, 500)
.some(r => r[row.sourceCn] === null || r[row.sourceCn] === undefined || r[row.sourceCn] === "" )) {
return `null value violates not-null constraint`
}
}
switch (v.uidt) { switch (v.uidt) {
case UITypes.Number: case UITypes.Number:
if (this.parsedCsv && this.parsedCsv.data && this.parsedCsv.data.slice(0, 500) if (this.parsedCsv && this.parsedCsv.data && this.parsedCsv.data.slice(0, 500)

Loading…
Cancel
Save