From 710643d8cba9872145292df25b24d5ce1b7bdbdf Mon Sep 17 00:00:00 2001 From: Torsten Bronger Date: Mon, 1 Feb 2021 21:50:53 +0100 Subject: [PATCH] Added field archivedAt to cards, lists, swimlanes, and boards. --- models/boards.js | 9 ++++++++- models/cards.js | 8 ++++++++ models/lists.js | 10 +++++++++- models/swimlanes.js | 9 ++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/models/boards.js b/models/boards.js index c08148d9f..586195c86 100644 --- a/models/boards.js +++ b/models/boards.js @@ -43,6 +43,13 @@ Boards.attachSchema( } }, }, + archivedAt: { + /** + * Latest archiving time of the board + */ + type: Date, + optional: true, + }, createdAt: { /** * Creation time of the board @@ -1042,7 +1049,7 @@ Boards.helpers({ Boards.mutations({ archive() { - return { $set: { archived: true } }; + return { $set: { archived: true, archivedAt: new Date() } }; }, restore() { diff --git a/models/cards.js b/models/cards.js index 74b7b8bfb..75be5455c 100644 --- a/models/cards.js +++ b/models/cards.js @@ -26,6 +26,13 @@ Cards.attachSchema( } }, }, + archivedAt: { + /** + * latest archiving date + */ + type: Date, + optional: true, + }, parentId: { /** * ID of the parent card @@ -1446,6 +1453,7 @@ Cards.mutations({ return { $set: { archived: true, + archivedAt: new Date(), }, }; }, diff --git a/models/lists.js b/models/lists.js index 920221683..13a4ce8aa 100644 --- a/models/lists.js +++ b/models/lists.js @@ -32,6 +32,13 @@ Lists.attachSchema( } }, }, + archivedAt: { + /** + * latest archiving date + */ + type: Date, + optional: true, + }, boardId: { /** * the board associated to this list @@ -292,7 +299,7 @@ Lists.mutations({ return card.archive(); }); } - return { $set: { archived: true } }; + return { $set: { archived: true, archivedAt: new Date() } }; }, restore() { @@ -384,6 +391,7 @@ if (Meteor.isServer) { Meteor.startup(() => { Lists._collection._ensureIndex({ modifiedAt: -1 }); Lists._collection._ensureIndex({ boardId: 1 }); + Lists._collection._ensureIndex({ archivedAt: -1 }); }); Lists.after.insert((userId, doc) => { diff --git a/models/swimlanes.js b/models/swimlanes.js index 0994e9044..8cb0c8e9c 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -23,6 +23,13 @@ Swimlanes.attachSchema( } }, }, + archivedAt: { + /** + * latest archiving date of the swimlane + */ + type: Date, + optional: true, + }, boardId: { /** * the ID of the board the swimlane is attached to @@ -259,7 +266,7 @@ Swimlanes.mutations({ return list.archive(); }); } - return { $set: { archived: true } }; + return { $set: { archived: true, archivedAt: new Date() } }; }, restore() {