1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/helpers/card-labels/delete-one.js

63 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
module.exports = {
inputs: {
record: {
type: 'ref',
required: true,
2019-08-31 04:07:25 +05:00
},
project: {
type: 'ref',
required: true,
},
2019-08-31 04:07:25 +05:00
board: {
type: 'ref',
required: true,
2019-08-31 04:07:25 +05:00
},
list: {
type: 'ref',
required: true,
},
card: {
type: 'ref',
required: true,
},
actorUser: {
type: 'ref',
required: true,
},
2019-08-31 04:07:25 +05:00
request: {
type: 'ref',
},
2019-08-31 04:07:25 +05:00
},
async fn(inputs) {
2019-08-31 04:07:25 +05:00
const cardLabel = await CardLabel.destroyOne(inputs.record.id);
if (cardLabel) {
sails.sockets.broadcast(
`board:${inputs.board.id}`,
'cardLabelDelete',
{
item: cardLabel,
2019-08-31 04:07:25 +05:00
},
inputs.request,
2019-08-31 04:07:25 +05:00
);
sails.helpers.utils.sendWebhooks.with({
event: 'cardLabelDelete',
data: {
item: cardLabel,
included: {
projects: [inputs.project],
boards: [inputs.board],
lists: [inputs.list],
cards: [inputs.card],
},
},
user: inputs.actorUser,
});
2019-08-31 04:07:25 +05:00
}
return cardLabel;
},
2019-08-31 04:07:25 +05:00
};