Migrating UI for new data structures

This commit is contained in:
Stefan Zermatten
2021-10-15 11:12:40 +02:00
parent f3c52999e8
commit ea68cdf86f
35 changed files with 511 additions and 271 deletions

View File

@@ -38,7 +38,7 @@ export default function migrateProperty({collection, reversed, prop}){
{from: 'dependencies'}
];
let migratedProp = transformFields(prop, transforms, reversed);
const schema = collection.simpleSchema({type: prop.type});
const schema = collection.simpleSchema({type: migratedProp.type});
// Only clean if the schema version matches our destination version
if(!reversed && SCHEMA_VERSION === 1){
try {
@@ -80,7 +80,9 @@ const transformsByPropType = {
{from: 'type', to: 'type', up: () => 'action'},
],
'attribute': [
...getComputedPropertyTransforms('baseValue'),
{from: 'baseValueCalculation', to: 'baseValue.calculation'},
{from: 'baseValue', to: 'baseValue.value', up: nanToNull},
{from: 'baseValueErrors', to: 'baseValue.errors', up: trimErrors},
...getComputedPropertyTransforms('spellSlotLevel'),
...getInlineComputationTransforms('description'),
{from: 'value', to: 'total', up: nanToNull},

View File

@@ -13,7 +13,6 @@ const exampleAction = {
'_id':'FaK6jXEj3pSe7mNuu',
'quantity': '1',
'variableName':'HunterTech',
'statId':'qccf9j5tfNJjZ3GGn',
'statName':'Hunter\'s Technique',
'available':5
}],