api: fix the sort field when inserting a swimlane or a list

This has the side effect of always inserting the element at the end.
This commit is contained in:
Benjamin Tissoires 2019-01-25 10:57:46 +01:00
parent 5c6a725712
commit b5411841cf
2 changed files with 4 additions and 0 deletions

View file

@ -314,9 +314,11 @@ if (Meteor.isServer) {
try {
Authentication.checkUserId( req.userId);
const paramBoardId = req.params.boardId;
const board = Boards.findOne(paramBoardId);
const id = Lists.insert({
title: req.body.title,
boardId: paramBoardId,
sort: board.lists().count(),
});
JsonRoutes.sendResult(res, {
code: 200,

View file

@ -256,9 +256,11 @@ if (Meteor.isServer) {
try {
Authentication.checkUserId( req.userId);
const paramBoardId = req.params.boardId;
const board = Boards.findOne(paramBoardId);
const id = Swimlanes.insert({
title: req.body.title,
boardId: paramBoardId,
sort: board.swimlanes().count(),
});
JsonRoutes.sendResult(res, {
code: 200,