mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
29 lines
604 B
JavaScript
29 lines
604 B
JavaScript
module.exports = {
|
|
inputs: {
|
|
userOrId: {
|
|
type: 'ref',
|
|
custom: (value) => _.isObjectLike(value) || _.isString(value),
|
|
required: true,
|
|
},
|
|
action: {
|
|
type: 'ref',
|
|
required: true,
|
|
},
|
|
},
|
|
|
|
async fn(inputs) {
|
|
const { userId = inputs.userOrId } = inputs.userOrId;
|
|
|
|
const notification = await Notification.create({
|
|
userId,
|
|
actionId: inputs.action.id,
|
|
cardId: inputs.action.cardId,
|
|
}).fetch();
|
|
|
|
sails.sockets.broadcast(`user:${userId}`, 'notificationCreate', {
|
|
item: notification,
|
|
});
|
|
|
|
return notification;
|
|
},
|
|
};
|