Made proficiencies their own objects, added migration functionality
This commit is contained in:
31
rpg-docs/server/migrations/migrations.js
Normal file
31
rpg-docs/server/migrations/migrations.js
Normal file
@@ -0,0 +1,31 @@
|
||||
Migrations.add({
|
||||
version: 1,
|
||||
up: function() {
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 2,
|
||||
name: "converts effect proficiencies to proficiency objects",
|
||||
up: function() {
|
||||
Effects.find({operation: "proficiency"}).forEach(function(effect){
|
||||
var type;
|
||||
if(_.contains(SKILLS, effect.stat)) type = "skill";
|
||||
if(_.contains(SAVES, effect.stat)) type = "save";
|
||||
if(!type) throw "stat not a skill or a save";
|
||||
Proficiencies.insert({
|
||||
charId: effect.charId,
|
||||
name: effect.stat,
|
||||
value: effect.value,
|
||||
parent: effect.parent,
|
||||
type: type,
|
||||
enabled: effect.enabled
|
||||
});
|
||||
Effects.remove(effect._id);
|
||||
});
|
||||
},
|
||||
down: function(){
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -3,9 +3,9 @@ Meteor.publish("singleCharacter", function(characterId, userId){
|
||||
Characters.findOne({
|
||||
_id: characterId,
|
||||
$or: [
|
||||
{readers: userId},
|
||||
{writers: userId},
|
||||
{owner: userId}
|
||||
{readers: userId},
|
||||
{writers: userId},
|
||||
{owner: userId}
|
||||
]
|
||||
})
|
||||
){
|
||||
@@ -24,6 +24,7 @@ Meteor.publish("singleCharacter", function(characterId, userId){
|
||||
Spells.find ({charId: characterId}, {removed: true}),
|
||||
SpellLists.find ({charId: characterId}, {removed: true}),
|
||||
TemporaryHitPoints.find({charId: characterId}, {removed: true}),
|
||||
Proficiencies.find ({charId: characterId}, {removed: true}),
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user