diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2018-03-19 00:25:19 -0300 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2018-03-19 01:25:33 -0300 |
commit | bf7de463f1f71f1758b62187667bf3a7e55585ff (patch) | |
tree | 61c06deb85d6bd401d2acb7cc9960777cb7f65f4 /server | |
parent | 83848dbee2e6e283e33667cfa9649aafc7c07f4e (diff) | |
download | wekan-bf7de463f1f71f1758b62187667bf3a7e55585ff.tar.gz wekan-bf7de463f1f71f1758b62187667bf3a7e55585ff.tar.bz2 wekan-bf7de463f1f71f1758b62187667bf3a7e55585ff.zip |
Add checklist items model, migration and publication
Diffstat (limited to 'server')
-rw-r--r-- | server/migrations.js | 21 | ||||
-rw-r--r-- | server/publications/boards.js | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/server/migrations.js b/server/migrations.js index f2cb124b..467dd4c2 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -187,3 +187,24 @@ Migrations.add('add-views', () => { } }); }); + +Migrations.add('add-checklist-items', () => { + Checklists.find().forEach((checklist) => { + // Create new items + _.sortBy(checklist.items, 'sort').forEach((item) => { + ChecklistItems.direct.insert({ + title: item.title, + sort: item.sort, + isFinished: item.isFinished, + checklistId: checklist._id, + cardId: checklist.cardId, + }); + }); + + // Delete old ones + Checklists.direct.update({ _id: checklist._id }, + { $unset: { items : 1 } }, + noValidate + ); + }); +}); diff --git a/server/publications/boards.js b/server/publications/boards.js index 889bd177..17d87f3a 100644 --- a/server/publications/boards.js +++ b/server/publications/boards.js @@ -101,6 +101,7 @@ Meteor.publishRelations('board', function(boardId) { this.cursor(CardComments.find({ cardId })); this.cursor(Attachments.find({ cardId })); this.cursor(Checklists.find({ cardId })); + this.cursor(ChecklistItems.find({ cardId })); }); if (board.members) { |