2021-06-24 01:05:22 +05:00
|
|
|
module.exports = {
|
|
|
|
inputs: {
|
|
|
|
record: {
|
|
|
|
type: 'ref',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
request: {
|
|
|
|
type: 'ref',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
async fn(inputs) {
|
2022-12-26 21:10:50 +01:00
|
|
|
const projectRelatedUserIds = await sails.helpers.projects.getManagerAndBoardMemberUserIds(
|
2021-06-24 01:05:22 +05:00
|
|
|
inputs.record.projectId,
|
|
|
|
);
|
|
|
|
|
|
|
|
const projectManager = await ProjectManager.destroyOne(inputs.record.id);
|
|
|
|
|
|
|
|
if (projectManager) {
|
2022-12-26 21:10:50 +01:00
|
|
|
projectRelatedUserIds.forEach((userId) => {
|
2021-06-24 01:05:22 +05:00
|
|
|
sails.sockets.broadcast(
|
|
|
|
`user:${userId}`,
|
|
|
|
'projectManagerDelete',
|
|
|
|
{
|
|
|
|
item: projectManager,
|
|
|
|
},
|
|
|
|
inputs.request,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return projectManager;
|
|
|
|
},
|
|
|
|
};
|