sharkey/src/server/api/endpoints/stats.ts

27 lines
493 B
TypeScript
Raw Normal View History

2018-04-08 02:30:37 +09:00
import Note from '../../../models/note';
2018-03-29 20:32:18 +09:00
import User from '../../../models/user';
2017-08-12 15:17:03 +09:00
/**
* Get the misskey's statistics
2017-08-12 15:17:03 +09:00
*/
module.exports = params => new Promise(async (res, rej) => {
const notesCount = await Note.count();
2017-08-12 15:17:03 +09:00
const usersCount = await User.count();
const originalNotesCount = await Note.count({
'_user.host': null
});
const originalUsersCount = await User.count({
host: null
});
2017-08-12 15:17:03 +09:00
res({
notesCount,
usersCount,
originalNotesCount,
originalUsersCount
2017-08-12 15:17:03 +09:00
});
});