1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 05:39:43 +02:00
planka/server/api/helpers/lists/delete-one.js

41 lines
717 B
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
},
board: {
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) {
const list = await List.archiveOne(inputs.record.id);
2019-08-31 04:07:25 +05:00
if (list) {
2019-08-31 04:07:25 +05:00
sails.sockets.broadcast(
`board:${list.boardId}`,
'listDelete',
2019-08-31 04:07:25 +05:00
{
item: list,
2019-08-31 04:07:25 +05:00
},
inputs.request,
2019-08-31 04:07:25 +05:00
);
await sails.helpers.utils.sendWebhook.with({
event: 'LIST_DELETE',
data: list,
projectId: inputs.board.projectId,
user: inputs.request.currentUser,
board: inputs.board,
});
2019-08-31 04:07:25 +05:00
}
return list;
},
2019-08-31 04:07:25 +05:00
};