mirror of
https://github.com/plankanban/planka.git
synced 2025-07-26 00:29:48 +02:00
ref: Remove board types, refactoring
This commit is contained in:
parent
2b131f76c1
commit
6ffa817b53
182 changed files with 1573 additions and 1239 deletions
|
@ -20,11 +20,6 @@ module.exports = {
|
|||
regex: /^[0-9]+$/,
|
||||
required: true,
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
isIn: Object.values(Board.Types),
|
||||
required: true,
|
||||
},
|
||||
position: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
|
@ -70,7 +65,7 @@ module.exports = {
|
|||
throw Errors.PROJECT_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
const values = _.pick(inputs, ['type', 'position', 'name']);
|
||||
const values = _.pick(inputs, ['position', 'name']);
|
||||
|
||||
let boardImport;
|
||||
if (inputs.importType && Object.values(Board.ImportTypes).includes(inputs.importType)) {
|
||||
|
@ -102,14 +97,16 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
const { board, boardMembership } = await sails.helpers.boards.createOne(
|
||||
values,
|
||||
boardImport,
|
||||
currentUser,
|
||||
project,
|
||||
inputs.requestId,
|
||||
this.req,
|
||||
);
|
||||
const { board, boardMembership } = await sails.helpers.boards.createOne.with({
|
||||
values: {
|
||||
...values,
|
||||
project,
|
||||
},
|
||||
import: boardImport,
|
||||
user: currentUser,
|
||||
requestId: inputs.requestId,
|
||||
request: this.req,
|
||||
});
|
||||
|
||||
if (this.req.isSocket) {
|
||||
sails.sockets.join(this.req, `board:${board.id}`); // TODO: only when subscription needed
|
||||
|
|
|
@ -39,7 +39,10 @@ module.exports = {
|
|||
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
board = await sails.helpers.boards.deleteOne(board, this.req);
|
||||
board = await sails.helpers.boards.deleteOne.with({
|
||||
record: board,
|
||||
request: this.req,
|
||||
});
|
||||
|
||||
if (!board) {
|
||||
throw Errors.BOARD_NOT_FOUND;
|
||||
|
|
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
const labels = await sails.helpers.boards.getLabels(board.id);
|
||||
const lists = await sails.helpers.boards.getLists(board.id);
|
||||
|
||||
const cards = await sails.helpers.boards.getCards(board);
|
||||
const cards = await sails.helpers.boards.getCards(board.id);
|
||||
const cardIds = sails.helpers.utils.mapRecords(cards);
|
||||
|
||||
const cardSubscriptions = await sails.helpers.cardSubscriptions.getMany({
|
||||
|
@ -69,7 +69,8 @@ module.exports = {
|
|||
);
|
||||
|
||||
cards.forEach((card) => {
|
||||
card.isSubscribed = isSubscribedByCardId[card.id] || false; // eslint-disable-line no-param-reassign
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
card.isSubscribed = isSubscribedByCardId[card.id] || false;
|
||||
});
|
||||
|
||||
if (this.req.isSocket) {
|
||||
|
|
|
@ -47,7 +47,12 @@ module.exports = {
|
|||
}
|
||||
|
||||
const values = _.pick(inputs, ['position', 'name']);
|
||||
board = await sails.helpers.boards.updateOne(board, values, this.req);
|
||||
|
||||
board = await sails.helpers.boards.updateOne.with({
|
||||
values,
|
||||
record: board,
|
||||
request: this.req,
|
||||
});
|
||||
|
||||
if (!board) {
|
||||
throw Errors.BOARD_NOT_FOUND;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue