summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/cards.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/models/cards.js b/models/cards.js
index 0a440697..6896970c 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -38,6 +38,21 @@ Cards.attachSchema(new SimpleSchema({
}
},
},
+ customFields: {
+ type: [Object],
+ optional: true,
+ },
+ 'customFields.$': {
+ type: new SimpleSchema({
+ _id: {
+ type: String,
+ },
+ value: {
+ type: Match.OneOf(String,Number,Boolean,Date),
+ optional: true,
+ },
+ })
+ },
dateLastActivity: {
type: Date,
autoValue() {
@@ -238,6 +253,24 @@ Cards.mutations({
}
},
+ assignCustomField(customFieldId) {
+ console.log("assignCustomField", customFieldId);
+ return {$push: {customFields: {_id: customFieldId, value: null}}};
+ },
+
+ unassignCustomField(customFieldId) {
+ console.log("unassignCustomField", customFieldId);
+ return {$pull: {customFields: {_id: customFieldId}}};
+ },
+
+ toggleCustomField(customFieldId) {
+ if (this.customFields && this.customFields[customFieldId]) {
+ return this.unassignCustomField(customFieldId);
+ } else {
+ return this.assignCustomField(customFieldId);
+ }
+ },
+
setCover(coverId) {
return {$set: {coverId}};
},