summaryrefslogtreecommitdiffstats
path: root/models/checklistItems.js
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2018-10-26 07:27:24 +0200
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2019-01-18 17:02:56 +0100
commitff467402c0c24981078f1f8e2b92b26b0d67d00a (patch)
tree289b4647e571f7896172028068b2bd130cbfa757 /models/checklistItems.js
parent49d3eb5a3f21fad1eb2952eb3da2f93c5c5d6272 (diff)
downloadwekan-ff467402c0c24981078f1f8e2b92b26b0d67d00a.tar.gz
wekan-ff467402c0c24981078f1f8e2b92b26b0d67d00a.tar.bz2
wekan-ff467402c0c24981078f1f8e2b92b26b0d67d00a.zip
RESTAPI: Add some JSDoc
So we can have a decent REST API documentation generated.
Diffstat (limited to 'models/checklistItems.js')
-rw-r--r--models/checklistItems.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/models/checklistItems.js b/models/checklistItems.js
index 9867dd94..35b18ed7 100644
--- a/models/checklistItems.js
+++ b/models/checklistItems.js
@@ -1,21 +1,39 @@
ChecklistItems = new Mongo.Collection('checklistItems');
+/**
+ * An item in a checklist
+ */
ChecklistItems.attachSchema(new SimpleSchema({
title: {
+ /**
+ * the text of the item
+ */
type: String,
},
sort: {
+ /**
+ * the sorting field of the item
+ */
type: Number,
decimal: true,
},
isFinished: {
+ /**
+ * Is the item checked?
+ */
type: Boolean,
defaultValue: false,
},
checklistId: {
+ /**
+ * the checklist ID the item is attached to
+ */
type: String,
},
cardId: {
+ /**
+ * the card ID the item is attached to
+ */
type: String,
},
}));
@@ -193,6 +211,17 @@ if (Meteor.isServer) {
}
if (Meteor.isServer) {
+ /**
+ * @operation get_checklist_item
+ * @tag Checklists
+ * @summary Get a checklist item
+ *
+ * @param {string} boardId the board ID
+ * @param {string} cardId the card ID
+ * @param {string} checklistId the checklist ID
+ * @param {string} itemId the ID of the item
+ * @return_type ChecklistItems
+ */
JsonRoutes.add('GET', '/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId', function (req, res) {
Authentication.checkUserId( req.userId);
const paramItemId = req.params.itemId;
@@ -209,6 +238,19 @@ if (Meteor.isServer) {
}
});
+ /**
+ * @operation edit_checklist_item
+ * @tag Checklists
+ * @summary Edit a checklist item
+ *
+ * @param {string} boardId the board ID
+ * @param {string} cardId the card ID
+ * @param {string} checklistId the checklist ID
+ * @param {string} itemId the ID of the item
+ * @param {string} [isFinished] is the item checked?
+ * @param {string} [title] the new text of the item
+ * @return_type {_id: string}
+ */
JsonRoutes.add('PUT', '/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId', function (req, res) {
Authentication.checkUserId( req.userId);
@@ -229,6 +271,19 @@ if (Meteor.isServer) {
});
});
+ /**
+ * @operation delete_checklist_item
+ * @tag Checklists
+ * @summary Delete a checklist item
+ *
+ * @description Note: this operation can't be reverted.
+ *
+ * @param {string} boardId the board ID
+ * @param {string} cardId the card ID
+ * @param {string} checklistId the checklist ID
+ * @param {string} itemId the ID of the item to be removed
+ * @return_type {_id: string}
+ */
JsonRoutes.add('DELETE', '/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items/:itemId', function (req, res) {
Authentication.checkUserId( req.userId);
const paramItemId = req.params.itemId;