You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
planka_custom/server/api/helpers/create-attachment.js

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);
},
};