1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00
planka/server/api/helpers/lists/delete-one.js
HannesOberreiter 3779bdb053
feat: Events via webhook (#771)
Closes #215, closes #656
2024-06-06 20:22:14 +02:00

40 lines
717 B
JavaScript

module.exports = {
inputs: {
record: {
type: 'ref',
required: true,
},
board: {
type: 'ref',
required: true,
},
request: {
type: 'ref',
},
},
async fn(inputs) {
const list = await List.archiveOne(inputs.record.id);
if (list) {
sails.sockets.broadcast(
`board:${list.boardId}`,
'listDelete',
{
item: list,
},
inputs.request,
);
await sails.helpers.utils.sendWebhook.with({
event: 'LIST_DELETE',
data: list,
projectId: inputs.board.projectId,
user: inputs.request.currentUser,
board: inputs.board,
});
}
return list;
},
};