summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/stats.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-04-23 22:35:26 +0900
committerGitHub <noreply@github.com>2019-04-23 22:35:26 +0900
commit0463c6bb0f8fd32740ceb61ccce04c662272a618 (patch)
treea28cbdf6c9cdc14648b8c0e46248665a3ad7e5af /src/server/api/endpoints/stats.ts
parentFix #4768 (diff)
downloadsharkey-0463c6bb0f8fd32740ceb61ccce04c662272a618.tar.gz
sharkey-0463c6bb0f8fd32740ceb61ccce04c662272a618.tar.bz2
sharkey-0463c6bb0f8fd32740ceb61ccce04c662272a618.zip
Refactor API (#4770)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update description.ts * wip
Diffstat (limited to 'src/server/api/endpoints/stats.ts')
-rw-r--r--src/server/api/endpoints/stats.ts36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts
index f3ebaa16ad..f85109b4b4 100644
--- a/src/server/api/endpoints/stats.ts
+++ b/src/server/api/endpoints/stats.ts
@@ -1,6 +1,7 @@
import define from '../define';
import { Notes, Users } from '../../../models';
import { federationChart, driveChart } from '../../../services/chart';
+import { bool, types } from '../../../misc/schema';
export const meta = {
requireCredential: false,
@@ -15,26 +16,32 @@ export const meta = {
},
res: {
- type: 'object',
+ type: types.object,
+ optional: bool.false, nullable: bool.false,
properties: {
notesCount: {
- type: 'number',
+ type: types.number,
+ optional: bool.false, nullable: bool.false,
description: 'The count of all (local/remote) notes of this instance.',
},
originalNotesCount: {
- type: 'number',
+ type: types.number,
+ optional: bool.false, nullable: bool.false,
description: 'The count of all local notes of this instance.',
},
usersCount: {
- type: 'number',
+ type: types.number,
+ optional: bool.false, nullable: bool.false,
description: 'The count of all (local/remote) accounts of this instance.',
},
originalUsersCount: {
- type: 'number',
+ type: types.number,
+ optional: bool.false, nullable: bool.false,
description: 'The count of all local accounts of this instance.',
},
instances: {
- type: 'number',
+ type: types.number,
+ optional: bool.false, nullable: bool.false,
description: 'The count of federated instances.',
},
}
@@ -42,7 +49,14 @@ export const meta = {
};
export default define(meta, async () => {
- const [notesCount, originalNotesCount, usersCount, originalUsersCount, instances, driveUsageLocal, driveUsageRemote] = await Promise.all([
+ const [notesCount,
+ originalNotesCount,
+ usersCount,
+ originalUsersCount,
+ instances,
+ driveUsageLocal,
+ driveUsageRemote
+ ] = await Promise.all([
Notes.count(),
Notes.count({ userHost: null }),
Users.count(),
@@ -53,6 +67,12 @@ export default define(meta, async () => {
]);
return {
- notesCount, originalNotesCount, usersCount, originalUsersCount, instances, driveUsageLocal, driveUsageRemote
+ notesCount,
+ originalNotesCount,
+ usersCount,
+ originalUsersCount,
+ instances,
+ driveUsageLocal,
+ driveUsageRemote
};
});