mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-26 21:26:43 -06:00
a1b490afa7
Closes #1411
48 lines
992 B
TypeScript
48 lines
992 B
TypeScript
/**
|
|
* 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>}
|
|
*/
|
|
module.exports = params => new Promise(async (res, rej) => {
|
|
const notesCount = await Note
|
|
.count();
|
|
|
|
const usersCount = await User
|
|
.count();
|
|
|
|
res({
|
|
notesCount: notesCount,
|
|
usersCount: usersCount
|
|
});
|
|
});
|