diff options
-rw-r--r-- | models/boards.js | 6 | ||||
-rw-r--r-- | models/cards.js | 194 | ||||
-rw-r--r-- | models/export.js | 4 |
3 files changed, 102 insertions, 102 deletions
diff --git a/models/boards.js b/models/boards.js index e3d82fc9..11df0bb5 100644 --- a/models/boards.js +++ b/models/boards.js @@ -320,12 +320,12 @@ Boards.helpers({ return _id; }, - searchCards(term, excludeImported) { + searchCards(term, excludeLinked) { check(term, Match.OneOf(String, null, undefined)); const query = { boardId: this._id }; - if (excludeImported) { - query.importedId = null; + if (excludeLinked) { + query.linkedId = null; } const projection = { limit: 10, sort: { createdAt: -1 } }; diff --git a/models/cards.js b/models/cards.js index c6e80ea8..2c0da093 100644 --- a/models/cards.js +++ b/models/cards.js @@ -136,7 +136,7 @@ Cards.attachSchema(new SimpleSchema({ type: { type: String, }, - importedId: { + linkedId: { type: String, optional: true, }, @@ -185,26 +185,26 @@ Cards.helpers({ }, activities() { - if (this.isImportedCard()) { - return Activities.find({cardId: this.importedId}, {sort: {createdAt: -1}}); - } else if (this.isImportedBoard()) { - return Activities.find({boardId: this.importedId}, {sort: {createdAt: -1}}); + if (this.isLinkedCard()) { + return Activities.find({cardId: this.linkedId}, {sort: {createdAt: -1}}); + } else if (this.isLinkedBoard()) { + return Activities.find({boardId: this.linkedId}, {sort: {createdAt: -1}}); } else { return Activities.find({cardId: this._id}, {sort: {createdAt: -1}}); } }, comments() { - if (this.isImportedCard()) { - return CardComments.find({cardId: this.importedId}, {sort: {createdAt: -1}}); + if (this.isLinkedCard()) { + return CardComments.find({cardId: this.linkedId}, {sort: {createdAt: -1}}); } else { return CardComments.find({cardId: this._id}, {sort: {createdAt: -1}}); } }, attachments() { - if (this.isImportedCard()) { - return Attachments.find({cardId: this.importedId}, {sort: {uploadedAt: -1}}); + if (this.isLinkedCard()) { + return Attachments.find({cardId: this.linkedId}, {sort: {uploadedAt: -1}}); } else { return Attachments.find({cardId: this._id}, {sort: {uploadedAt: -1}}); } @@ -218,8 +218,8 @@ Cards.helpers({ }, checklists() { - if (this.isImportedCard()) { - return Checklists.find({cardId: this.importedId}, {sort: { sort: 1 } }); + if (this.isLinkedCard()) { + return Checklists.find({cardId: this.linkedId}, {sort: { sort: 1 } }); } else { return Checklists.find({cardId: this._id}, {sort: { sort: 1 } }); } @@ -412,23 +412,23 @@ Cards.helpers({ return this.parentId === ''; }, - isImportedCard() { - return this.type === 'cardType-importedCard'; + isLinkedCard() { + return this.type === 'cardType-linkedCard'; }, - isImportedBoard() { - return this.type === 'cardType-importedBoard'; + isLinkedBoard() { + return this.type === 'cardType-linkedBoard'; }, - isImported() { - return this.isImportedCard() || this.isImportedBoard(); + isLinked() { + return this.isLinkedCard() || this.isLinkedBoard(); }, setDescription(description) { - if (this.isImportedCard()) { - return Cards.update({_id: this.importedId}, {$set: {description}}); - } else if (this.isImportedBoard()) { - return Boards.update({_id: this.importedId}, {$set: {description}}); + if (this.isLinkedCard()) { + return Cards.update({_id: this.linkedId}, {$set: {description}}); + } else if (this.isLinkedBoard()) { + return Boards.update({_id: this.linkedId}, {$set: {description}}); } else { return Cards.update( {_id: this._id}, @@ -438,14 +438,14 @@ Cards.helpers({ }, getDescription() { - if (this.isImportedCard()) { - const card = Cards.findOne({_id: this.importedId}); + if (this.isLinkedCard()) { + const card = Cards.findOne({_id: this.linkedId}); if (card && card.description) return card.description; else return null; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); if (board && board.description) return board.description; else @@ -458,11 +458,11 @@ Cards.helpers({ }, getMembers() { - if (this.isImportedCard()) { - const card = Cards.findOne({_id: this.importedId}); + if (this.isLinkedCard()) { + const card = Cards.findOne({_id: this.linkedId}); return card.members; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); return board.activeMembers().map((member) => { return member.userId; }); @@ -472,13 +472,13 @@ Cards.helpers({ }, assignMember(memberId) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, { $addToSet: { members: memberId }} ); - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); return board.addMember(memberId); } else { return Cards.update( @@ -489,13 +489,13 @@ Cards.helpers({ }, unassignMember(memberId) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, { $pull: { members: memberId }} ); - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); return board.removeMember(memberId); } else { return Cards.update( @@ -514,8 +514,8 @@ Cards.helpers({ }, getReceived() { - if (this.isImportedCard()) { - const card = Cards.findOne({_id: this.importedId}); + if (this.isLinkedCard()) { + const card = Cards.findOne({_id: this.linkedId}); return card.receivedAt; } else { return this.receivedAt; @@ -523,9 +523,9 @@ Cards.helpers({ }, setReceived(receivedAt) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {receivedAt}} ); } else { @@ -537,11 +537,11 @@ Cards.helpers({ }, getStart() { - if (this.isImportedCard()) { - const card = Cards.findOne({_id: this.importedId}); + if (this.isLinkedCard()) { + const card = Cards.findOne({_id: this.linkedId}); return card.startAt; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); return board.startAt; } else { return this.startAt; @@ -549,14 +549,14 @@ Cards.helpers({ }, setStart(startAt) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, {$set: {startAt}} ); - } else if (this.isImportedBoard()) { + } else if (this.isLinkedBoard()) { return Boards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {startAt}} ); } else { @@ -568,11 +568,11 @@ Cards.helpers({ }, getDue() { - if (this.isImportedCard()) { - const card = Cards.findOne({_id: this.importedId}); + if (this.isLinkedCard()) { + const card = Cards.findOne({_id: this.linkedId}); return card.dueAt; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); return board.dueAt; } else { return this.dueAt; @@ -580,14 +580,14 @@ Cards.helpers({ }, setDue(dueAt) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, {$set: {dueAt}} ); - } else if (this.isImportedBoard()) { + } else if (this.isLinkedBoard()) { return Boards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {dueAt}} ); } else { @@ -599,11 +599,11 @@ Cards.helpers({ }, getEnd() { - if (this.isImportedCard()) { - const card = Cards.findOne({_id: this.importedId}); + if (this.isLinkedCard()) { + const card = Cards.findOne({_id: this.linkedId}); return card.endAt; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({_id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({_id: this.linkedId}); return board.endAt; } else { return this.endAt; @@ -611,14 +611,14 @@ Cards.helpers({ }, setEnd(endAt) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, {$set: {endAt}} ); - } else if (this.isImportedBoard()) { + } else if (this.isLinkedBoard()) { return Boards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {endAt}} ); } else { @@ -630,11 +630,11 @@ Cards.helpers({ }, getIsOvertime() { - if (this.isImportedCard()) { - const card = Cards.findOne({ _id: this.importedId }); + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); return card.isOvertime; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({ _id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({ _id: this.linkedId}); return board.isOvertime; } else { return this.isOvertime; @@ -642,14 +642,14 @@ Cards.helpers({ }, setIsOvertime(isOvertime) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, {$set: {isOvertime}} ); - } else if (this.isImportedBoard()) { + } else if (this.isLinkedBoard()) { return Boards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {isOvertime}} ); } else { @@ -661,11 +661,11 @@ Cards.helpers({ }, getSpentTime() { - if (this.isImportedCard()) { - const card = Cards.findOne({ _id: this.importedId }); + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); return card.spentTime; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({ _id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({ _id: this.linkedId}); return board.spentTime; } else { return this.spentTime; @@ -673,14 +673,14 @@ Cards.helpers({ }, setSpentTime(spentTime) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, {$set: {spentTime}} ); - } else if (this.isImportedBoard()) { + } else if (this.isLinkedBoard()) { return Boards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {spentTime}} ); } else { @@ -692,11 +692,11 @@ Cards.helpers({ }, getTitle() { - if (this.isImportedCard()) { - const card = Cards.findOne({ _id: this.importedId }); + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); return card.title; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({ _id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({ _id: this.linkedId}); return board.title; } else { return this.title; @@ -704,12 +704,12 @@ Cards.helpers({ }, getBoardTitle() { - if (this.isImportedCard()) { - const card = Cards.findOne({ _id: this.importedId }); + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); const board = Boards.findOne({ _id: card.boardId }); return board.title; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({ _id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({ _id: this.linkedId}); return board.title; } else { const board = Boards.findOne({ _id: this.boardId }); @@ -718,14 +718,14 @@ Cards.helpers({ }, setTitle(title) { - if (this.isImportedCard()) { + if (this.isLinkedCard()) { return Cards.update( - { _id: this.importedId }, + { _id: this.linkedId }, {$set: {title}} ); - } else if (this.isImportedBoard()) { + } else if (this.isLinkedBoard()) { return Boards.update( - {_id: this.importedId}, + {_id: this.linkedId}, {$set: {title}} ); } else { @@ -737,11 +737,11 @@ Cards.helpers({ }, getArchived() { - if (this.isImportedCard()) { - const card = Cards.findOne({ _id: this.importedId }); + if (this.isLinkedCard()) { + const card = Cards.findOne({ _id: this.linkedId }); return card.archived; - } else if (this.isImportedBoard()) { - const board = Boards.findOne({ _id: this.importedId}); + } else if (this.isLinkedBoard()) { + const board = Boards.findOne({ _id: this.linkedId}); return board.archived; } else { return this.archived; diff --git a/models/export.js b/models/export.js index 8d4f5448..ed4c52d9 100644 --- a/models/export.js +++ b/models/export.js @@ -45,7 +45,7 @@ class Exporter { build() { const byBoard = { boardId: this._boardId }; - const byBoardNoImported = { boardId: this._boardId, importedId: null }; + const byBoardNoLinked = { boardId: this._boardId, linkedId: null }; // we do not want to retrieve boardId in related elements const noBoardId = { fields: { boardId: 0 } }; const result = { @@ -53,7 +53,7 @@ class Exporter { }; _.extend(result, Boards.findOne(this._boardId, { fields: { stars: 0 } })); result.lists = Lists.find(byBoard, noBoardId).fetch(); - result.cards = Cards.find(byBoardNoImported, noBoardId).fetch(); + result.cards = Cards.find(byBoardNoLinked, noBoardId).fetch(); result.swimlanes = Swimlanes.find(byBoard, noBoardId).fetch(); result.comments = CardComments.find(byBoard, noBoardId).fetch(); result.activities = Activities.find(byBoard, noBoardId).fetch(); |