forked from jappel/leistungsbilanz-ts
Verify Revit reference CSV
This commit is contained in:
parent
bfe8b790b2
commit
da689af518
8 changed files with 149 additions and 11 deletions
|
|
@ -19,7 +19,6 @@ const requiredColumnKeys = [
|
|||
"selectionMarker",
|
||||
"circuitIdentifier",
|
||||
"power",
|
||||
"quantity",
|
||||
] as const;
|
||||
|
||||
export function assertExternalCsvConfiguration(
|
||||
|
|
@ -56,6 +55,16 @@ export function assertExternalCsvConfiguration(
|
|||
}
|
||||
mappedColumns.add(columnName);
|
||||
}
|
||||
if (value.columns.quantity !== null) {
|
||||
const quantityColumn = assertTrimmedString(
|
||||
value.columns.quantity,
|
||||
"columns.quantity"
|
||||
);
|
||||
if (mappedColumns.has(quantityColumn)) {
|
||||
throw new Error(`External CSV column is mapped more than once: ${quantityColumn}`);
|
||||
}
|
||||
mappedColumns.add(quantityColumn);
|
||||
}
|
||||
|
||||
if (!Array.isArray(value.additionalSourceMappings)) {
|
||||
throw new Error("External CSV additional source mappings must be an array.");
|
||||
|
|
@ -115,6 +124,11 @@ export function assertExternalCsvConfiguration(
|
|||
throw new Error(`familyTypeRules.${index}.category is unsupported.`);
|
||||
}
|
||||
assertQuantityRule(rule.quantityRule, index);
|
||||
if (rule.quantityRule.kind === "mapped-column" && value.columns.quantity === null) {
|
||||
throw new Error(
|
||||
`familyTypeRules.${index}.quantityRule requires a configured quantity column.`
|
||||
);
|
||||
}
|
||||
assertDisplayNameSuggestion(rule.displayNameSuggestion, index);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue