1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/helpers/actions/update-one.js

39 lines
619 B
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
module.exports = {
inputs: {
record: {
type: 'ref',
required: true,
2019-08-31 04:07:25 +05:00
},
values: {
type: 'json',
required: true,
2019-08-31 04:07:25 +05:00
},
board: {
type: 'ref',
required: true,
2019-08-31 04:07:25 +05:00
},
request: {
type: 'ref',
},
2019-08-31 04:07:25 +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',
{
item: action,
2019-08-31 04:07:25 +05:00
},
inputs.request,
2019-08-31 04:07:25 +05:00
);
}
return action;
},
2019-08-31 04:07:25 +05:00
};