mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 15:33:08 +02:00
Provide originalNotesCount and originalUsersCount
This commit is contained in:
parent
ecd71ef5ff
commit
4116b9eaf2
1 changed files with 15 additions and 37 deletions
|
@ -1,48 +1,26 @@
|
||||||
/**
|
|
||||||
* Module dependencies
|
|
||||||
*/
|
|
||||||
import Note from '../../../models/note';
|
import Note from '../../../models/note';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* Get the misskey's statistics
|
||||||
* /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) => {
|
module.exports = params => new Promise(async (res, rej) => {
|
||||||
const notesCount = await Note
|
const notesCount = await Note.count();
|
||||||
.count();
|
|
||||||
|
|
||||||
const usersCount = await User
|
const usersCount = await User.count();
|
||||||
.count();
|
|
||||||
|
const originalNotesCount = await Note.count({
|
||||||
|
'_user.host': null
|
||||||
|
});
|
||||||
|
|
||||||
|
const originalUsersCount = await User.count({
|
||||||
|
host: null
|
||||||
|
});
|
||||||
|
|
||||||
res({
|
res({
|
||||||
notesCount: notesCount,
|
notesCount,
|
||||||
usersCount: usersCount
|
usersCount,
|
||||||
|
originalNotesCount,
|
||||||
|
originalUsersCount
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue