2019-08-31 04:07:25 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
|
|
|
record: {
|
|
|
|
type: 'ref',
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
values: {
|
|
|
|
type: 'json',
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
2024-06-12 00:51:36 +02:00
|
|
|
project: {
|
2024-06-06 20:22:14 +02:00
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
board: {
|
|
|
|
type: 'ref',
|
2019-11-05 18:01:42 +05:00
|
|
|
required: true,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
2024-06-12 00:51:36 +02:00
|
|
|
list: {
|
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
card: {
|
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
actorUser: {
|
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
request: {
|
2019-11-05 18:01:42 +05:00
|
|
|
type: 'ref',
|
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
async fn(inputs) {
|
2022-12-26 21:10:50 +01:00
|
|
|
const { values } = inputs;
|
|
|
|
|
|
|
|
const action = await Action.updateOne(inputs.record.id).set({ ...values });
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
if (action) {
|
|
|
|
sails.sockets.broadcast(
|
|
|
|
`board:${inputs.board.id}`,
|
|
|
|
'actionUpdate',
|
|
|
|
{
|
2019-11-05 18:01:42 +05:00
|
|
|
item: action,
|
2019-08-31 04:07:25 +05:00
|
|
|
},
|
2019-11-05 18:01:42 +05:00
|
|
|
inputs.request,
|
2019-08-31 04:07:25 +05:00
|
|
|
);
|
2024-06-06 20:22:14 +02:00
|
|
|
|
2024-06-12 00:51:36 +02:00
|
|
|
sails.helpers.utils.sendWebhooks.with({
|
|
|
|
event: 'actionUpdate',
|
|
|
|
data: {
|
|
|
|
item: action,
|
|
|
|
included: {
|
|
|
|
projects: [inputs.project],
|
|
|
|
boards: [inputs.board],
|
|
|
|
lists: [inputs.list],
|
|
|
|
cards: [inputs.card],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
user: inputs.actorUser,
|
2024-06-06 20:22:14 +02:00
|
|
|
});
|
2019-08-31 04:07:25 +05:00
|
|
|
}
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
return action;
|
2019-11-05 18:01:42 +05:00
|
|
|
},
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|