Added cascading deletions

This commit is contained in:
Thaum
2015-03-04 10:17:32 +00:00
parent 88dbaccfc5
commit a5068f1bc2
10 changed files with 72 additions and 34 deletions

View File

@@ -29,3 +29,13 @@ Containers.helpers({
return weight;
}
});
Containers.before.remove(function (userId, container) {
if(Meteor.isServer){
Items.remove({container: container._id});
} else {
Items.find({container: container._id}).forEach(function(item){
Items.remove(item._id);
});
}
});