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:
parent
7956503a46
commit
fe91b5241e
478 changed files with 21226 additions and 19495 deletions
39
server/api/helpers/card-labels/create-one.js
Normal file
39
server/api/helpers/card-labels/create-one.js
Normal 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;
|
||||
},
|
||||
};
|
32
server/api/helpers/card-labels/delete-one.js
Normal file
32
server/api/helpers/card-labels/delete-one.js
Normal 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;
|
||||
},
|
||||
};
|
12
server/api/helpers/card-labels/get-many.js
Normal file
12
server/api/helpers/card-labels/get-many.js
Normal 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');
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue