Improved handling of poorly migrated archive creatures

This commit is contained in:
Stefan Zermatten
2022-03-08 14:12:11 +02:00
parent 12fc9b1be3
commit fada07e048
3 changed files with 45 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
import cleanAt1 from '/imports/migrations/server/dbv1/cleanAt1.js';
/* eslint no-fallthrough: "off" -- Using switch fallthrough to run all
migration steps after the current version of the file. */
@@ -17,17 +17,3 @@ function migrateLegacyArchive(archive){
// TODO:
throw 'Not implemented';
}
function cleanAt1(archive){
archive.properties.map(prop => {
const schema = CreatureProperties.simpleSchema(prop);
const cleanProp = schema.clean(prop);
try {
schema.validate(cleanProp);
} catch (e){
console.warn('Prop did not pass schema validation');
console.warn(e);
}
return cleanProp;
});
}