1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

feat: Webhooks configuration, all events support, refactoring

This commit is contained in:
Maksim Eltyshev 2024-06-12 00:51:36 +02:00
parent 193daf6cfb
commit 87683fe523
96 changed files with 1280 additions and 509 deletions

View file

@ -37,7 +37,7 @@ module.exports = {
type: 'json',
custom: importValidator,
},
user: {
actorUser: {
type: 'ref',
required: true,
},
@ -80,6 +80,8 @@ module.exports = {
position: nextPosition,
},
});
// TODO: send webhooks
});
});
@ -90,12 +92,12 @@ module.exports = {
}).fetch();
if (inputs.import && inputs.import.type === Board.ImportTypes.TRELLO) {
await sails.helpers.boards.importFromTrello(inputs.user, board, inputs.import.board);
await sails.helpers.boards.importFromTrello(board, inputs.import.board, inputs.actorUser);
}
const boardMembership = await BoardMembership.create({
boardId: board.id,
userId: inputs.user.id,
userId: inputs.actorUser.id,
role: BoardMembership.Roles.EDITOR,
}).fetch();
@ -111,12 +113,15 @@ module.exports = {
);
});
await sails.helpers.utils.sendWebhook.with({
event: 'BOARD_CREATE',
data: board,
projectId: board.projectId,
user: inputs.request.currentUser,
board,
sails.helpers.utils.sendWebhooks.with({
event: 'boardCreate',
data: {
item: board,
included: {
projects: [values.project],
},
},
user: inputs.actorUser,
});
return {