From e55d7e4f72a4b425c4aca5ba04a7be1fc642649b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Manelli?= Date: Wed, 15 Aug 2018 20:50:51 +0200 Subject: Fix removed setters and getters --- models/cards.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'models') diff --git a/models/cards.js b/models/cards.js index 171c21c5..1cb1e3d0 100644 --- a/models/cards.js +++ b/models/cards.js @@ -88,7 +88,6 @@ Cards.attachSchema(new SimpleSchema({ type: String, optional: true, defaultValue: '', - }, assignedBy: { type: String, @@ -769,6 +768,52 @@ Cards.helpers({ return this.archived; } }, + + setRequestedBy(requestedBy) { + if (this.isLinkedCard()) { + return Cards.update( + { _id: this.linkedId }, + {$set: {requestedBy}} + ); + } else { + return Cards.update( + {_id: this._id}, + {$set: {requestedBy}} + ); + } + }, + + getRequestedBy() { + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); + return card.requestedBy; + } else { + return this.requestedBy; + } + }, + + setAssignedBy(assignedBy) { + if (this.isLinkedCard()) { + return Cards.update( + { _id: this.linkedId }, + {$set: {assignedBy}} + ); + } else { + return Cards.update( + {_id: this._id}, + {$set: {assignedBy}} + ); + } + }, + + getAssignedBy() { + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); + return card.assignedBy; + } else { + return this.assignedBy; + } + }, }); Cards.mutations({ -- cgit v1.2.3-1-g7c22