1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

Project managers, board members, auto-update after reconnection, refactoring

This commit is contained in:
Maksim Eltyshev 2021-06-24 01:05:22 +05:00
parent 7956503a46
commit fe91b5241e
478 changed files with 21226 additions and 19495 deletions

View file

@ -0,0 +1,39 @@
module.exports = {
inputs: {
label: {
type: 'ref',
required: true,
},
card: {
type: 'ref',
required: true,
},
request: {
type: 'ref',
},
},
exits: {
labelAlreadyInCard: {},
},
async fn(inputs) {
const cardLabel = await CardLabel.create({
cardId: inputs.card.id,
labelId: inputs.label.id,
})
.intercept('E_UNIQUE', 'labelAlreadyInCard')
.fetch();
sails.sockets.broadcast(
`board:${inputs.card.boardId}`,
'cardLabelCreate',
{
item: cardLabel,
},
inputs.request,
);
return cardLabel;
},
};

View file

@ -0,0 +1,32 @@
module.exports = {
inputs: {
record: {
type: 'ref',
required: true,
},
board: {
type: 'ref',
required: true,
},
request: {
type: 'ref',
},
},
async fn(inputs) {
const cardLabel = await CardLabel.destroyOne(inputs.record.id);
if (cardLabel) {
sails.sockets.broadcast(
`board:${inputs.board.id}`,
'cardLabelDelete',
{
item: cardLabel,
},
inputs.request,
);
}
return cardLabel;
},
};

View file

@ -0,0 +1,12 @@
module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
},
},
async fn(inputs) {
return CardLabel.find(inputs.criteria).sort('id');
},
};