diff options
Diffstat (limited to 'models/checklistItems.js')
-rw-r--r-- | models/checklistItems.js | 55 |
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; |