check for invalid motions on import

This commit is contained in:
Maximilian Krambach 2019-02-27 11:24:04 +01:00
parent e4c79fd371
commit 308b593763
1 changed files with 8 additions and 1 deletions

View File

@ -122,12 +122,19 @@ export class MotionImportService extends BaseImportService<ViewMotion> {
}
}
const updateModels = this.repo.getMotionDuplicates(newEntry);
return {
const entry: NewEntry<ViewMotion> = {
newEntry: newEntry,
duplicates: updateModels,
status: updateModels.length ? 'error' : 'new',
errors: updateModels.length ? ['Duplicates'] : []
};
if (!entry.newEntry.title) {
this.setError(entry, 'Title');
}
if (!entry.newEntry.text) {
this.setError(entry, 'Title');
}
return entry;
}
/**