From f3382abe3bc1cd9d5583708d5fdbe550e57a8a38 Mon Sep 17 00:00:00 2001 From: Atila Romero Date: Sun, 12 May 2019 10:01:32 -0300 Subject: Add partentId support on card web API --- models/cards.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/models/cards.js b/models/cards.js index d5a59377..fdb7deb3 100644 --- a/models/cards.js +++ b/models/cards.js @@ -1685,6 +1685,7 @@ if (Meteor.isServer) { * @param {string} boardId the board ID of the new card * @param {string} listId the list ID of the new card * @param {string} authorID the user ID of the person owning the card + * @param {string} parentId the parent ID of the new card * @param {string} title the title of the new card * @param {string} description the description of the new card * @param {string} swimlaneId the swimlane ID of the new card @@ -1695,6 +1696,7 @@ if (Meteor.isServer) { Authentication.checkUserId(req.userId); const paramBoardId = req.params.boardId; const paramListId = req.params.listId; + const paramParentId = req.params.parentId; const currentCards = Cards.find({ listId: paramListId, archived: false, @@ -1708,6 +1710,7 @@ if (Meteor.isServer) { title: req.body.title, boardId: paramBoardId, listId: paramListId, + parentId: paramParentId, description: req.body.description, userId: req.body.authorId, swimlaneId: req.body.swimlaneId, @@ -1761,6 +1764,7 @@ if (Meteor.isServer) { * @param {string} [listId] the new list ID of the card (move operation) * @param {string} [description] the new description of the card * @param {string} [authorId] change the owner of the card + * @param {string} [parentId] change the parent of the card * @param {string} [labelIds] the new list of label IDs attached to the card * @param {string} [swimlaneId] the new swimlane ID of the card * @param {string} [members] the new list of member IDs attached to the card @@ -1817,6 +1821,19 @@ if (Meteor.isServer) { }, paramListId); } + if (req.body.hasOwnProperty('parentId')) { + const newParentId = req.body.parentId; + Cards.direct.update({ + _id: paramCardId, + listId: paramListId, + boardId: paramBoardId, + archived: false, + }, { + $set: { + parentId: newParentId, + }, + }); + } if (req.body.hasOwnProperty('description')) { const newDescription = req.body.description; Cards.direct.update({ -- cgit v1.2.3-1-g7c22