mirror of
https://github.com/plankanban/planka.git
synced 2025-07-20 13:49:43 +02:00
feat: Webhooks configuration, all events support, refactoring
This commit is contained in:
parent
3779bdb053
commit
c065566c15
96 changed files with 1280 additions and 509 deletions
|
@ -25,6 +25,10 @@ module.exports = {
|
|||
custom: valuesValidator,
|
||||
required: true,
|
||||
},
|
||||
project: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
board: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
|
@ -66,6 +70,8 @@ module.exports = {
|
|||
position: nextPosition,
|
||||
},
|
||||
});
|
||||
|
||||
// TODO: send webhooks
|
||||
});
|
||||
|
||||
const card = await Card.create({
|
||||
|
@ -85,6 +91,19 @@ module.exports = {
|
|||
inputs.request,
|
||||
);
|
||||
|
||||
sails.helpers.utils.sendWebhooks.with({
|
||||
event: 'cardCreate',
|
||||
data: {
|
||||
item: card,
|
||||
included: {
|
||||
projects: [inputs.project],
|
||||
boards: [inputs.board],
|
||||
lists: [values.list],
|
||||
},
|
||||
},
|
||||
user: values.creatorUser,
|
||||
});
|
||||
|
||||
if (values.creatorUser.subscribeToOwnCards) {
|
||||
await CardSubscription.create({
|
||||
cardId: card.id,
|
||||
|
@ -97,6 +116,8 @@ module.exports = {
|
|||
isSubscribed: true,
|
||||
},
|
||||
});
|
||||
|
||||
// TODO: send webhooks
|
||||
}
|
||||
|
||||
await sails.helpers.actions.createOne.with({
|
||||
|
@ -108,18 +129,10 @@ module.exports = {
|
|||
},
|
||||
user: values.creatorUser,
|
||||
},
|
||||
board: inputs.board,
|
||||
request: inputs.request,
|
||||
});
|
||||
|
||||
await sails.helpers.utils.sendWebhook.with({
|
||||
event: 'CARD_CREATE',
|
||||
data: card,
|
||||
projectId: inputs.board.projectId,
|
||||
user: inputs.request.currentUser,
|
||||
card,
|
||||
project: inputs.project,
|
||||
board: inputs.board,
|
||||
list: values.list,
|
||||
request: inputs.request,
|
||||
});
|
||||
|
||||
return card;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue