Types (with forced checks!)
This commit is contained in:
parent
420cfd0f96
commit
6c610a3181
|
@ -111,21 +111,19 @@ export function importToRows(data: any, table: Table, user: any = {}) {
|
||||||
row = processed.row
|
row = processed.row
|
||||||
table = processed.table
|
table = processed.table
|
||||||
|
|
||||||
let fieldName: any
|
for (const [fieldName, schema] of Object.entries(table.schema)) {
|
||||||
let schema: any
|
|
||||||
for ([fieldName, schema] of Object.entries(table.schema)) {
|
|
||||||
// check whether the options need to be updated for inclusion as part of the data import
|
// check whether the options need to be updated for inclusion as part of the data import
|
||||||
if (
|
if (
|
||||||
schema.type === FieldTypes.OPTIONS &&
|
schema.type === FieldTypes.OPTIONS &&
|
||||||
row[fieldName] &&
|
row[fieldName] &&
|
||||||
(!schema.constraints.inclusion ||
|
(!schema.constraints!.inclusion ||
|
||||||
schema.constraints.inclusion.indexOf(row[fieldName]) === -1)
|
schema.constraints!.inclusion.indexOf(row[fieldName]) === -1)
|
||||||
) {
|
) {
|
||||||
schema.constraints.inclusion = [
|
schema.constraints!.inclusion = [
|
||||||
...schema.constraints.inclusion,
|
...schema.constraints!.inclusion!,
|
||||||
row[fieldName],
|
row[fieldName],
|
||||||
]
|
]
|
||||||
schema.constraints.inclusion.sort()
|
schema.constraints!.inclusion.sort()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue