mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 07:23:10 +02:00
Clean up
This commit is contained in:
parent
b893305974
commit
0975959eb9
3 changed files with 0 additions and 78 deletions
|
@ -1,13 +0,0 @@
|
|||
const deleteUser = require('../built/models/user').deleteUser;
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const userId = args[0];
|
||||
|
||||
console.log(`deleting ${userId}...`);
|
||||
|
||||
deleteUser(userId).then(() => {
|
||||
console.log('done');
|
||||
}, e => {
|
||||
console.error(e);
|
||||
});
|
|
@ -1,23 +0,0 @@
|
|||
const mongo = require('mongodb');
|
||||
const User = require('../built/models/user').default;
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const user = args[0];
|
||||
|
||||
const q = user.startsWith('@') ? {
|
||||
username: user.split('@')[1],
|
||||
host: user.split('@')[2] || null
|
||||
} : { _id: new mongo.ObjectID(user) };
|
||||
|
||||
console.log(`Mark as verfied ${user}...`);
|
||||
|
||||
User.update(q, {
|
||||
$set: {
|
||||
isVerified: true
|
||||
}
|
||||
}).then(() => {
|
||||
console.log(`Done ${user}`);
|
||||
}, e => {
|
||||
console.error(e);
|
||||
});
|
|
@ -1,42 +0,0 @@
|
|||
const { default: Note } = require('../built/models/note');
|
||||
const { default: Meta } = require('../built/models/meta');
|
||||
const { default: User } = require('../built/models/user');
|
||||
|
||||
async function main() {
|
||||
const meta = await Meta.findOne({});
|
||||
|
||||
const notesCount = await Note.count();
|
||||
|
||||
const usersCount = await User.count();
|
||||
|
||||
const originalNotesCount = await Note.count({
|
||||
'_user.host': null
|
||||
});
|
||||
|
||||
const originalUsersCount = await User.count({
|
||||
host: null
|
||||
});
|
||||
|
||||
const stats = {
|
||||
notesCount,
|
||||
usersCount,
|
||||
originalNotesCount,
|
||||
originalUsersCount
|
||||
};
|
||||
|
||||
if (meta) {
|
||||
await Meta.update({}, {
|
||||
$set: {
|
||||
stats
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await Meta.insert({
|
||||
stats
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
console.log('done');
|
||||
}).catch(console.error);
|
Loading…
Reference in a new issue