mirror of
https://github.com/plankanban/planka.git
synced 2025-07-21 14:19:44 +02:00
Project managers, board members, auto-update after reconnection, refactoring
This commit is contained in:
parent
d6cb1f6683
commit
b39119ace4
478 changed files with 21226 additions and 19495 deletions
|
@ -1,52 +0,0 @@
|
|||
module.exports = {
|
||||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref',
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
await ProjectMembership.destroy({
|
||||
userId: inputs.record.id,
|
||||
});
|
||||
|
||||
await CardSubscription.destroy({
|
||||
userId: inputs.record.id,
|
||||
});
|
||||
|
||||
await CardMembership.destroy({
|
||||
userId: inputs.record.id,
|
||||
});
|
||||
|
||||
const user = await User.updateOne({
|
||||
id: inputs.record.id,
|
||||
deletedAt: null,
|
||||
}).set({
|
||||
deletedAt: new Date().toUTCString(),
|
||||
});
|
||||
|
||||
if (user) {
|
||||
const adminUserIds = await sails.helpers.getAdminUserIds();
|
||||
const projectIds = await sails.helpers.getMembershipProjectIdsForUser(user.id);
|
||||
const userIdsForProject = await sails.helpers.getMembershipUserIdsForProject(projectIds);
|
||||
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
|
||||
|
||||
userIds.forEach((userId) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${userId}`,
|
||||
'userDelete',
|
||||
{
|
||||
item: user,
|
||||
},
|
||||
inputs.request,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return exits.success(user);
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue