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

View File

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