mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Moved new_checklist_item API to correct file where is other checklist item API.
Thanks to xet7 !
This commit is contained in:
parent
8951d0aa57
commit
9de7040401
2 changed files with 45 additions and 45 deletions
|
@ -282,6 +282,51 @@ if (Meteor.isServer) {
|
|||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @operation new_checklist_item
|
||||
* @summary add a new item to a checklist
|
||||
*
|
||||
* @param {string} boardId the board ID
|
||||
* @param {string} cardId the card ID
|
||||
* @param {string} checklistId the ID of the checklist
|
||||
* @param {string} title the title of the new item
|
||||
* @return_type {_id: string}
|
||||
*/
|
||||
|
||||
JsonRoutes.add(
|
||||
'POST',
|
||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items',
|
||||
function(req, res) {
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramChecklistId = req.params.checklistId;
|
||||
const paramCardId = req.params.cardId;
|
||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
const checklist = Checklists.findOne({
|
||||
_id: paramChecklistId,
|
||||
cardId: paramCardId,
|
||||
});
|
||||
if (checklist) {
|
||||
const id = ChecklistItems.insert({
|
||||
cardId: paramCardId,
|
||||
checklistId: paramChecklistId,
|
||||
title: req.body.title,
|
||||
isFinished: false,
|
||||
sort: 0,
|
||||
});
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: {
|
||||
_id: id,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 404,
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @operation edit_checklist_item
|
||||
* @tag Checklists
|
||||
|
|
|
@ -383,51 +383,6 @@ if (Meteor.isServer) {
|
|||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @operation new_checklist_item
|
||||
* @summary add a new item to a checklist
|
||||
*
|
||||
* @param {string} boardId the board ID
|
||||
* @param {string} cardId the card ID
|
||||
* @param {string} checklistId the ID of the checklist
|
||||
* @param {string} title the title of the new item
|
||||
* @return_type {_id: string}
|
||||
*/
|
||||
|
||||
JsonRoutes.add(
|
||||
'POST',
|
||||
'/api/boards/:boardId/cards/:cardId/checklists/:checklistId/items',
|
||||
function(req, res) {
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramChecklistId = req.params.checklistId;
|
||||
const paramCardId = req.params.cardId;
|
||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
const checklist = Checklists.findOne({
|
||||
_id: paramChecklistId,
|
||||
cardId: paramCardId,
|
||||
});
|
||||
if (checklist) {
|
||||
const id = ChecklistItems.insert({
|
||||
cardId: paramCardId,
|
||||
checklistId: paramChecklistId,
|
||||
title: req.body.title,
|
||||
isFinished: false,
|
||||
sort: 0,
|
||||
});
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: {
|
||||
_id: id,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 404,
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @operation delete_checklist
|
||||
* @summary Delete a checklist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue