ソースを参照

changed edit_card and get_card_by_customfields

There was a bug in edit_card API: If I call API to edit listid and some fields It modifies only the listid. In addiction I've modified get_card_by_customfield to return full documents.
Unknown 5 年 前
コミット
95522ebcd9
2 ファイル変更32 行追加40 行削除
  1. 29 37
      models/cards.js
  2. 3 3
      models/users.js

+ 29 - 37
models/cards.js

@@ -2420,34 +2420,6 @@ if (Meteor.isServer) {
           },
         );
       }
-      if (req.body.hasOwnProperty('listId')) {
-        const newParamListId = req.body.listId;
-        Cards.direct.update(
-          {
-            _id: paramCardId,
-            listId: paramListId,
-            boardId: paramBoardId,
-            archived: false,
-          },
-          {
-            $set: {
-              listId: newParamListId,
-            },
-          },
-        );
-
-        const card = Cards.findOne({
-          _id: paramCardId,
-        });
-        cardMove(
-          req.body.authorId,
-          card,
-          {
-            fieldName: 'listId',
-          },
-          paramListId,
-        );
-      }
       if (req.body.hasOwnProperty('parentId')) {
         const newParentId = req.body.parentId;
         Cards.direct.update(
@@ -2691,6 +2663,34 @@ if (Meteor.isServer) {
           { $set: { swimlaneId: newParamSwimlaneId } },
         );
       }
+      if (req.body.hasOwnProperty('listId')) {
+        const newParamListId = req.body.listId;
+        Cards.direct.update(
+          {
+            _id: paramCardId,
+            listId: paramListId,
+            boardId: paramBoardId,
+            archived: false,
+          },
+          {
+            $set: {
+              listId: newParamListId,
+            },
+          },
+        );
+
+        const card = Cards.findOne({
+          _id: paramCardId,
+        });
+        cardMove(
+          req.body.authorId,
+          card,
+          {
+            fieldName: 'listId',
+          },
+          paramListId,
+        );
+      }
       JsonRoutes.sendResult(res, {
         code: 200,
         data: {
@@ -2772,15 +2772,7 @@ if (Meteor.isServer) {
             },
           },
           archived: false,
-        }).map(function(doc) {
-          return {
-            _id: doc._id,
-            title: doc.title,
-            description: doc.description,
-            listId: doc.listId,
-            swinlaneId: doc.swinlaneId,
-          };
-        }),
+        }).fetch(),
       });
     },
   );

+ 3 - 3
models/users.js

@@ -1136,9 +1136,9 @@ if (Meteor.isServer) {
         */
 
         const Future = require('fibers/future');
-        let future1 = new Future();
-        let future2 = new Future();
-        let future3 = new Future();
+        const future1 = new Future();
+        const future2 = new Future();
+        const future3 = new Future();
         Boards.insert(
           {
             title: TAPi18n.__('templates'),