浏览代码

createCardWithDueDate

DimDz 2 年之前
父节点
当前提交
ba387bcc84
共有 1 个文件被更改,包括 21 次插入0 次删除
  1. 21 0
      models/cards.js

+ 21 - 0
models/cards.js

@@ -2943,6 +2943,27 @@ function cardCreation(userId, doc) {
   });
 }
 
+Meteor.methods({
+  createCardWithDueDate: function(boardId, listId, title, dueDate, swimlaneId) {
+    check(boardId, String);
+    check(listId, String);
+    check(title, String);
+    check(dueDate, Date);
+    check(swimlaneId, String);
+    const card = {
+      title,
+      listId,
+      boardId,
+      swimlaneId,
+      createdAt: new Date(),
+      dueAt: dueDate,
+      sort: 0,
+    };
+    const cardId = Cards.insert(card);
+    return cardId;
+  },
+});
+
 function cardRemover(userId, doc) {
   ChecklistItems.remove({
     cardId: doc._id,