summaryrefslogtreecommitdiffstats
path: root/models/cards.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/cards.js')
-rw-r--r--models/cards.js161
1 files changed, 160 insertions, 1 deletions
diff --git a/models/cards.js b/models/cards.js
index de868dde..710b9d85 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -494,6 +494,166 @@ Cards.helpers({
return this.assignMember(memberId);
}
},
+
+ getReceived() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({_id: this.importedId});
+ return card.receivedAt;
+ } else {
+ return this.receivedAt;
+ }
+ },
+
+ setReceived(receivedAt) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ {_id: this.importedId},
+ {$set: {receivedAt}}
+ );
+ } else {
+ return {$set: {receivedAt}};
+ }
+ },
+
+ getStart() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({_id: this.importedId});
+ return card.startAt;
+ } else if (this.isImportedBoard()) {
+ const board = Boards.findOne({_id: this.importedId});
+ return board.startAt
+ } else {
+ return this.startAt;
+ }
+ },
+
+ setStart(startAt) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ { _id: this.importedId },
+ {$set: {startAt}}
+ );
+ } else if (this.isImportedBoard()) {
+ return Boards.update(
+ {_id: this.importedId},
+ {$set: {startAt}}
+ );
+ } else {
+ return {$set: {startAt}};
+ }
+ },
+
+ getDue() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({_id: this.importedId});
+ return card.dueAt;
+ } else if (this.isImportedBoard()) {
+ const board = Boards.findOne({_id: this.importedId});
+ return board.dueAt
+ } else {
+ return this.dueAt;
+ }
+ },
+
+ setDue(dueAt) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ { _id: this.importedId },
+ {$set: {dueAt}}
+ );
+ } else if (this.isImportedBoard()) {
+ return Boards.update(
+ {_id: this.importedId},
+ {$set: {dueAt}}
+ );
+ } else {
+ return {$set: {dueAt}};
+ }
+ },
+
+ getEnd() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({_id: this.importedId});
+ return card.endAt;
+ } else if (this.isImportedBoard()) {
+ const board = Boards.findOne({_id: this.importedId});
+ return board.endAt;
+ } else {
+ return this.endAt;
+ }
+ },
+
+ setEnd(endAt) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ { _id: this.importedId },
+ {$set: {endAt}}
+ );
+ } else if (this.isImportedBoard()) {
+ return Boards.update(
+ {_id: this.importedId},
+ {$set: {endAt}}
+ );
+ } else {
+ return {$set: {endAt}};
+ }
+ },
+
+ getIsOvertime() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({ _id: this.importedId });
+ return card.isOvertime;
+ } else if (this.isImportedBoard()) {
+ const board = Boards.findOne({ _id: this.importedId});
+ return board.isOvertime;
+ } else {
+ return this.isOvertime;
+ }
+ },
+
+ setIsOvertime(isOvertime) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ { _id: this.importedId },
+ {$set: {isOvertime}}
+ );
+ } else if (this.isImportedBoard()) {
+ return Boards.update(
+ {_id: this.importedId},
+ {$set: {isOvertime}}
+ );
+ } else {
+ return {$set: {isOvertime}};
+ }
+ },
+
+ getSpentTime() {
+ if (this.isImportedCard()) {
+ const card = Cards.findOne({ _id: this.importedId });
+ return card.spentTime;
+ } else if (this.isImportedBoard()) {
+ const board = Boards.findOne({ _id: this.importedId});
+ return board.spentTime;
+ } else {
+ return this.spentTime;
+ }
+ },
+
+ setSpentTime(spentTime) {
+ if (this.isImportedCard()) {
+ return Cards.update(
+ { _id: this.importedId },
+ {$set: {spentTime}}
+ );
+ } else if (this.isImportedBoard()) {
+ return Boards.update(
+ {_id: this.importedId},
+ {$set: {spentTime}}
+ );
+ } else {
+ return {$set: {spentTime}};
+ }
+ },
});
Cards.mutations({
@@ -657,7 +817,6 @@ Cards.mutations({
setParentId(parentId) {
return {$set: {parentId}};
},
-
});