2017-08-12 09:17:03 +03:00
|
|
|
/**
|
|
|
|
* Module dependencies
|
|
|
|
*/
|
2018-04-07 20:30:37 +03:00
|
|
|
import Note from '../../../models/note';
|
2018-03-29 14:32:18 +03:00
|
|
|
import User from '../../../models/user';
|
2017-08-12 09:17:03 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @swagger
|
|
|
|
* /stats:
|
2018-04-07 20:30:37 +03:00
|
|
|
* note:
|
2017-08-12 09:17:03 +03:00
|
|
|
* summary: Show the misskey's statistics
|
|
|
|
* responses:
|
|
|
|
* 200:
|
|
|
|
* description: Success
|
|
|
|
* schema:
|
|
|
|
* type: object
|
|
|
|
* properties:
|
2018-04-07 20:30:37 +03:00
|
|
|
* notesCount:
|
|
|
|
* description: count of all notes of misskey
|
2017-08-12 09:17:03 +03:00
|
|
|
* type: number
|
2018-03-29 08:48:47 +03:00
|
|
|
* usersCount:
|
2017-08-12 09:17:03 +03:00
|
|
|
* 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>}
|
|
|
|
*/
|
|
|
|
module.exports = params => new Promise(async (res, rej) => {
|
2018-04-07 20:30:37 +03:00
|
|
|
const notesCount = await Note
|
2017-08-12 09:17:03 +03:00
|
|
|
.count();
|
|
|
|
|
|
|
|
const usersCount = await User
|
|
|
|
.count();
|
|
|
|
|
|
|
|
res({
|
2018-04-07 20:30:37 +03:00
|
|
|
notesCount: notesCount,
|
2018-03-29 08:48:47 +03:00
|
|
|
usersCount: usersCount
|
2017-08-12 09:17:03 +03:00
|
|
|
});
|
|
|
|
});
|