scrubbing WIP
parent
9c1c32b14c
commit
b68b90cab8
|
@ -34,7 +34,7 @@ const tos =
|
|||
|
||||
scrub('clas_clas')(c => {
|
||||
c.updateMany({ 'created.by': userId }, { $set: { 'created.by': ghostId } });
|
||||
c.updateMany({ teachers: userId }, { $set: { 'teachers.$': ghostId } });
|
||||
c.updateMany({ teachers: userId }, { $pull: { teachers: userId } });
|
||||
});
|
||||
|
||||
scrub('clas_student')(c => c.remove({ userId: userId }));
|
||||
|
@ -50,16 +50,6 @@ scrub('game5')(c => {
|
|||
c.updateMany({ us: userId }, { $set: { 'us.$': ghostId } });
|
||||
});
|
||||
|
||||
// We decided not to delete PMs out of legit interest of the correspondents
|
||||
// and also to be able to comply to data requests from law enforcement
|
||||
|
||||
// const msgThreadIds = scrub('msg_thread')(c => {
|
||||
// const ids = c.distinct('_id', { users: userId });
|
||||
// c.remove({ users: userId });
|
||||
// return ids;
|
||||
// });
|
||||
// scrub('msg_msg')(c => msgThreadIds.length && c.remove({ tid: { $in: msgThreadIds } }));
|
||||
|
||||
scrub('puzzle2_puzzle', puzzleDb)(c => c.updateMany({ users: userId }, { $set: { 'users.$': ghostId } }));
|
||||
|
||||
scrub('puzzle2_round', puzzleDb)(c => c.remove({ _id: new RegExp(`^${userId}:`) }));
|
||||
|
@ -92,13 +82,56 @@ scrub('simul')(c => {
|
|||
c.updateMany({ 'pairings.player.user': userId }, { $set: { 'pairings.$.player.user': ghostId } });
|
||||
});
|
||||
|
||||
const swissIds = scrub('swiss')(c => {
|
||||
c.updateMany({ winnerId: userId }, { $set: { winnerId: ghostId } });
|
||||
return db.swiss_player.distinct('s', { u: userId });
|
||||
});
|
||||
|
||||
if (swissIds.length) {
|
||||
scrub('swiss_player')(c => {
|
||||
c.find({ _id: { $in: swissIds.map(s => `${s}:${userId}`) } }).forEach(p => {
|
||||
c.remove({ _id: p._id });
|
||||
p._id = `${p.s}:${ghostId}`;
|
||||
p.u = ghostId;
|
||||
c.insert(p);
|
||||
});
|
||||
});
|
||||
scrub('swiss_pairing')(c => c.updateMany({ s: { $in: swissIds }, p: userId }, { $set: { 'p.$': ghostId } }));
|
||||
}
|
||||
|
||||
scrub('team')(c => {
|
||||
c.updateMany({ createdBy: userId }, { $set: { createdBy: ghostId } });
|
||||
c.updateMany({ leaders: userId }, { $pull: { leaders: userId } });
|
||||
});
|
||||
|
||||
scrub('team_request')(c => c.remove({ user: userId }));
|
||||
|
||||
scrub('team_member')(c => c.remove({ user: userId }));
|
||||
|
||||
scrub('timeline_entry')(c => c.remove({ users: userId }));
|
||||
|
||||
scrub('tournament2')(c => {
|
||||
c.updateMany({ winnerId: userId }, { $set: { winnerId: ghostId } });
|
||||
c.updateMany({ createdBy: userId }, { $set: { createdBy: ghostId } });
|
||||
});
|
||||
const arenaIds = scrub('tournament_leaderboard')(c => {
|
||||
const ids = c.distinct('t', { u: userId });
|
||||
c.remove({ u: userId });
|
||||
return ids;
|
||||
});
|
||||
if (arenaIds.length) {
|
||||
scrub('tournament_player')(c => c.updateMany({ tid: { $in: arenaIds }, uid: userId }, { $set: { uid: ghostId } }));
|
||||
scrub('tournament_pairing')(c => c.updateMany({ tid: { $in: arenaIds }, u: userId }, { $set: { 'u.$': ghostId } }));
|
||||
}
|
||||
|
||||
/*
|
||||
swiss tournament
|
||||
swiss pairing
|
||||
swiss player
|
||||
team (leader)
|
||||
timeline entry
|
||||
tournament
|
||||
tournament leaderboard
|
||||
tournament pairing
|
||||
tournament player*/
|
||||
We decided not to delete PMs out of legit interest of the correspondents
|
||||
and also to be able to comply to data requests from law enforcement
|
||||
|
||||
const msgThreadIds = scrub('msg_thread')(c => {
|
||||
const ids = c.distinct('_id', { users: userId });
|
||||
c.remove({ users: userId });
|
||||
return ids;
|
||||
});
|
||||
scrub('msg_msg')(c => msgThreadIds.length && c.remove({ tid: { $in: msgThreadIds } }));
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue