Fix removed setters and getters

This commit is contained in:
Andrés Manelli 2018-08-15 20:50:51 +02:00
parent 53c0a52788
commit e55d7e4f72
2 changed files with 56 additions and 11 deletions

View file

@ -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({