1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 21:59:43 +02:00
planka/server/api/helpers/comments/delete-one.js

68 lines
1.2 KiB
JavaScript
Raw Normal View History

/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
2019-08-31 04:07:25 +05:00
module.exports = {
inputs: {
record: {
type: 'ref',
required: true,
2019-08-31 04:07:25 +05:00
},
project: {
type: 'ref',
required: true,
},
2019-08-31 04:07:25 +05:00
board: {
type: 'ref',
required: true,
2019-08-31 04:07:25 +05: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: {
type: 'ref',
},
2019-08-31 04:07:25 +05:00
},
async fn(inputs) {
const comment = await Comment.qm.deleteOne(inputs.record.id);
2022-12-26 21:10:50 +01:00
if (comment) {
2019-08-31 04:07:25 +05:00
sails.sockets.broadcast(
`board:${inputs.board.id}`,
'commentDelete',
2019-08-31 04:07:25 +05:00
{
item: comment,
2019-08-31 04:07:25 +05:00
},
inputs.request,
2019-08-31 04:07:25 +05:00
);
sails.helpers.utils.sendWebhooks.with({
event: 'commentDelete',
buildData: () => ({
item: comment,
included: {
projects: [inputs.project],
boards: [inputs.board],
lists: [inputs.list],
cards: [inputs.card],
},
}),
user: inputs.actorUser,
});
2019-08-31 04:07:25 +05:00
}
return comment;
},
2019-08-31 04:07:25 +05:00
};