mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
34 lines
561 B
JavaScript
34 lines
561 B
JavaScript
|
module.exports = {
|
||
|
inputs: {
|
||
|
card: {
|
||
|
type: 'ref',
|
||
|
required: true,
|
||
|
},
|
||
|
values: {
|
||
|
type: 'json',
|
||
|
required: true,
|
||
|
},
|
||
|
request: {
|
||
|
type: 'ref',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
async fn(inputs, exits) {
|
||
|
const attachment = await Attachment.create({
|
||
|
...inputs.values,
|
||
|
cardId: inputs.card.id,
|
||
|
}).fetch();
|
||
|
|
||
|
sails.sockets.broadcast(
|
||
|
`board:${inputs.card.boardId}`,
|
||
|
'attachmentCreate',
|
||
|
{
|
||
|
item: attachment,
|
||
|
},
|
||
|
inputs.request,
|
||
|
);
|
||
|
|
||
|
return exits.success(attachment);
|
||
|
},
|
||
|
};
|