From 8137f2692fe3e1d9f1c0a9b635ef15cdf36728f7 Mon Sep 17 00:00:00 2001 From: guillaume Date: Tue, 23 Apr 2019 18:00:09 +0200 Subject: remove feature --- models/lists.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'models/lists.js') diff --git a/models/lists.js b/models/lists.js index a8e597ee..1a0910c2 100644 --- a/models/lists.js +++ b/models/lists.js @@ -217,6 +217,10 @@ Lists.helpers({ isTemplateList() { return this.type === 'template-list'; }, + + remove() { + Lists.remove({ _id: this._id}); + }, }); Lists.mutations({ @@ -310,6 +314,12 @@ if (Meteor.isServer) { }); Lists.before.remove((userId, doc) => { + const cards = Cards.find({ listId: doc._id }); + if (cards) { + cards.forEach((card) => { + Cards.remove(card._id); + }); + } Activities.insert({ userId, type: 'list', -- cgit v1.2.3-1-g7c22