1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00
planka/server/api/helpers/project-managers/delete-one.js

34 lines
666 B
JavaScript

module.exports = {
inputs: {
record: {
type: 'ref',
required: true,
},
request: {
type: 'ref',
},
},
async fn(inputs) {
const userIds = await sails.helpers.projects.getManagerAndBoardMemberUserIds(
inputs.record.projectId,
);
const projectManager = await ProjectManager.destroyOne(inputs.record.id);
if (projectManager) {
userIds.forEach((userId) => {
sails.sockets.broadcast(
`user:${userId}`,
'projectManagerDelete',
{
item: projectManager,
},
inputs.request,
);
});
}
return projectManager;
},
};