This commit is contained in:
syuilo 2018-10-29 19:32:20 +09:00
parent 4b5727e1f2
commit 69e27d15a9
3 changed files with 0 additions and 78 deletions

View File

@ -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);
});

View File

@ -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);
});

View File

@ -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);