fix 500 error when importing file attributes

This commit is contained in:
Dan Percic 2021-11-17 17:23:43 +02:00
parent f60574e85a
commit b8d03810f0

View File

@ -162,7 +162,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
fileAttributeConfigs = fileAttributeConfigs.map(attr => new FileAttributeConfig({ ...attr, primaryAttribute: false }));
}
const fileAttributes = {
const fileAttributes: IFileAttributesConfig = {
...this.baseConfigForm.getRawValue(),
fileAttributeConfigs: [
...fileAttributeConfigs.filter(a => !this.allEntities.find(entity => entity.csvColumn === a.csvColumnHeader)),
@ -173,12 +173,14 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
label: field.name,
type: field.type,
primaryAttribute: field.primaryAttribute,
displayedInFileList: null,
filterable: null,
})),
],
};
try {
await this._fileAttributesService.setFileAttributesConfig(fileAttributes, this.data.dossierTemplateId).toPromise();
await this._fileAttributesService.setFileAttributeConfig(fileAttributes, this.data.dossierTemplateId).toPromise();
this._toaster.success(_('file-attributes-csv-import.save.success'), { params: { count: this.activeFields.length } });
} catch (e) {
this._toaster.error(_('file-attributes-csv-import.save.error'));