From 07a3a0b3882147effac890514b19ff84f1d76bdb Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 9 Jun 2021 01:12:23 +0300 Subject: [PATCH] Gantt: Retain links created between tasks. Part 1: Database changes, not active in MIT Wekan. Thanks to benjaminhrivera ! Related https://github.com/wekan/wekan/issues/2870#issuecomment-857115753 --- models/cards.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/models/cards.js b/models/cards.js index 54732897e..28ffb4022 100644 --- a/models/cards.js +++ b/models/cards.js @@ -445,6 +445,31 @@ Cards.attachSchema( type: Number, optional: true, }, + targetId_gantt: { + /** + * ID of card which is the child link in gantt view + */ + type: [String], + optional: true, + defaultValue: [], + }, + linkType_gantt: { + /** + * ID of card which is the parent link in gantt view + */ + type: [Number], + decimal: false, + optional: true, + defaultValue: [], + }, + linkId_gantt: { + /** + * ID of card which is the parent link in gantt view + */ + type: [String], + optional: true, + defaultValue: [], + }, }), ); @@ -468,6 +493,27 @@ Cards.allow({ }); Cards.helpers({ + // Gantt https://github.com/wekan/wekan/issues/2870#issuecomment-857171127 + setGanttTargetId(sourceId, targetId, linkType, linkId){ + return Cards.update({ _id: sourceId}, { + $push: { + targetId_gantt: targetId, + linkType_gantt : linkType, + linkId_gantt: linkId + } + }); + }, + + removeGanttTargetId(sourceId, targetId, linkType, linkId){ + return Cards.update({ _id: sourceId}, { + $pull: { + targetId_gantt: targetId, + linkType_gantt : linkType, + linkId_gantt: linkId + } + }); + }, + mapCustomFieldsToBoard(boardId) { // Map custom fields to new board return this.customFields.map(cf => {