summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/stats.ts
diff options
context:
space:
mode:
authorrinsuki <428rinsuki+git@gmail.com>2018-05-17 07:52:24 +0900
committerrinsuki <428rinsuki+git@gmail.com>2018-05-17 07:52:24 +0900
commit829b4012e6dc14eb64a3d8f60826fe9b6a41b40d (patch)
tree42ac37f323db349dca9316e6fdb39fc33b860686 /src/server/api/endpoints/stats.ts
parentadd yarn.lock to gitignore (diff)
parentUpdate deliver.ts (diff)
downloadmisskey-829b4012e6dc14eb64a3d8f60826fe9b6a41b40d.tar.gz
misskey-829b4012e6dc14eb64a3d8f60826fe9b6a41b40d.tar.bz2
misskey-829b4012e6dc14eb64a3d8f60826fe9b6a41b40d.zip
Merge branch 'master' into fix/yarn-lock-ignore
Diffstat (limited to 'src/server/api/endpoints/stats.ts')
-rw-r--r--src/server/api/endpoints/stats.ts52
1 files changed, 15 insertions, 37 deletions
diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts
index 52e5195484..d1e17651f2 100644
--- a/src/server/api/endpoints/stats.ts
+++ b/src/server/api/endpoints/stats.ts
@@ -1,48 +1,26 @@
-/**
- * Module dependencies
- */
import Note from '../../../models/note';
import User from '../../../models/user';
/**
- * @swagger
- * /stats:
- * note:
- * summary: Show the misskey's statistics
- * responses:
- * 200:
- * description: Success
- * schema:
- * type: object
- * properties:
- * notesCount:
- * description: count of all notes of misskey
- * type: number
- * usersCount:
- * description: count of all users of misskey
- * type: number
- *
- * default:
- * description: Failed
- * schema:
- * $ref: "#/definitions/Error"
- */
-
-/**
- * Show the misskey's statistics
- *
- * @param {any} params
- * @return {Promise<any>}
+ * Get the misskey's statistics
*/
module.exports = params => new Promise(async (res, rej) => {
- const notesCount = await Note
- .count();
+ const notesCount = await Note.count();
- const usersCount = await User
- .count();
+ const usersCount = await User.count();
+
+ const originalNotesCount = await Note.count({
+ '_user.host': null
+ });
+
+ const originalUsersCount = await User.count({
+ host: null
+ });
res({
- notesCount: notesCount,
- usersCount: usersCount
+ notesCount,
+ usersCount,
+ originalNotesCount,
+ originalUsersCount
});
});