mirror of
https://github.com/plankanban/planka.git
synced 2025-07-24 07:39:44 +02:00
ref: Define all possible event types in webhook module (#795)
This commit is contained in:
parent
caf8790f28
commit
de1ed3c784
1 changed files with 57 additions and 1 deletions
|
@ -1,3 +1,58 @@
|
||||||
|
const EVENT_TYPES = {
|
||||||
|
ACTION_CREATE: 'actionCreate',
|
||||||
|
ACTION_DELETE: 'actionDelete',
|
||||||
|
ACTION_UPDATE: 'actionUpdate',
|
||||||
|
|
||||||
|
ATTACHMENT_CREATE: 'attachmentCreate',
|
||||||
|
ATTACHMENT_DELETE: 'attachmentDelete',
|
||||||
|
ATTACHMENT_UPDATE: 'attachmentUpdate',
|
||||||
|
|
||||||
|
BOARD_CREATE: 'boardCreate',
|
||||||
|
BOARD_DELETE: 'boardDelete',
|
||||||
|
BOARD_UPDATE: 'boardUpdate',
|
||||||
|
|
||||||
|
BOARD_MEMBERSHIP_CREATE: 'boardMembershipCreate',
|
||||||
|
BOARD_MEMBERSHIP_DELETE: 'boardMembershipDelete',
|
||||||
|
BOARD_MEMBERSHIP_UPDATE: 'boardMembershipUpdate',
|
||||||
|
|
||||||
|
CARD_CREATE: 'cardCreate',
|
||||||
|
CARD_DELETE: 'cardDelete',
|
||||||
|
CARD_UPDATE: 'cardUpdate',
|
||||||
|
|
||||||
|
CARD_LABEL_CREATE: 'cardLabelCreate',
|
||||||
|
CARD_LABEL_DELETE: 'cardLabelDelete',
|
||||||
|
|
||||||
|
CARD_MEMBERSHIP_CREATE: 'cardMembershipCreate',
|
||||||
|
CARD_MEMBERSHIP_DELETE: 'cardMembershipDelete',
|
||||||
|
|
||||||
|
LABEL_CREATE: 'labelCreate',
|
||||||
|
LABEL_DELETE: 'labelDelete',
|
||||||
|
LABEL_UPDATE: 'labelUpdate',
|
||||||
|
|
||||||
|
LIST_CREATE: 'listCreate',
|
||||||
|
LIST_DELETE: 'listDelete',
|
||||||
|
LIST_SORT: 'listSort',
|
||||||
|
LIST_UPDATE: 'listUpdate',
|
||||||
|
|
||||||
|
NOTIFICATION_CREATE: 'notificationCreate',
|
||||||
|
NOTIFICATION_UPDATE: 'notificationUpdate',
|
||||||
|
|
||||||
|
PROJECT_CREATE: 'projectCreate',
|
||||||
|
PROJECT_DELETE: 'projectDelete',
|
||||||
|
PROJECT_UPDATE: 'projectUpdate',
|
||||||
|
|
||||||
|
PROJECT_MANAGER_CREATE: 'projectManagerCreate',
|
||||||
|
PROJECT_MANAGER_DELETE: 'projectManagerDelete',
|
||||||
|
|
||||||
|
TASK_CREATE: 'taskCreate',
|
||||||
|
TASK_DELETE: 'taskDelete',
|
||||||
|
TASK_UPDATE: 'taskUpdate',
|
||||||
|
|
||||||
|
USER_CREATE: 'userCreate',
|
||||||
|
USER_DELETE: 'userDelete',
|
||||||
|
USER_UPDATE: 'userUpdate',
|
||||||
|
};
|
||||||
|
|
||||||
const jsonifyData = (data) => {
|
const jsonifyData = (data) => {
|
||||||
const nextData = {};
|
const nextData = {};
|
||||||
|
|
||||||
|
@ -26,7 +81,7 @@ const jsonifyData = (data) => {
|
||||||
* Sends a webhook notification to a configured URL.
|
* Sends a webhook notification to a configured URL.
|
||||||
*
|
*
|
||||||
* @param {*} webhook - Webhook configuration.
|
* @param {*} webhook - Webhook configuration.
|
||||||
* @param {string} event - The event (see {@link Events}).
|
* @param {string} event - The event (see {@link EVENT_TYPES}).
|
||||||
* @param {*} data - The actual data related to the event.
|
* @param {*} data - The actual data related to the event.
|
||||||
* @param {ref} user - User object associated with the event.
|
* @param {ref} user - User object associated with the event.
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
|
@ -68,6 +123,7 @@ module.exports = {
|
||||||
event: {
|
event: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
|
isIn: Object.values(EVENT_TYPES),
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue