2020-04-21 05:04:34 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
|
|
|
record: {
|
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
values: {
|
|
|
|
type: 'json',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
board: {
|
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
request: {
|
|
|
|
type: 'ref',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
async fn(inputs) {
|
2022-12-26 21:10:50 +01:00
|
|
|
const { values } = inputs;
|
|
|
|
|
|
|
|
const attachment = await Attachment.updateOne(inputs.record.id).set({ ...values });
|
2020-04-21 05:04:34 +05:00
|
|
|
|
|
|
|
if (attachment) {
|
|
|
|
sails.sockets.broadcast(
|
|
|
|
`board:${inputs.board.id}`,
|
|
|
|
'attachmentUpdate',
|
|
|
|
{
|
|
|
|
item: attachment,
|
|
|
|
},
|
|
|
|
inputs.request,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
return attachment;
|
2020-04-21 05:04:34 +05:00
|
|
|
},
|
|
|
|
};
|