diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-08-12 15:17:03 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-08-12 15:17:03 +0900 |
| commit | dd1aa8c7d6ec003fcf187c1fc8e6c56f60723414 (patch) | |
| tree | 02138842254347d2ee8ceea73e439de040cc9ccb /src/api/endpoints/stats.ts | |
| parent | Merge pull request #687 from syuilo/greenkeeper/reconnecting-websocket-3.1.1 (diff) | |
| download | sharkey-dd1aa8c7d6ec003fcf187c1fc8e6c56f60723414.tar.gz sharkey-dd1aa8c7d6ec003fcf187c1fc8e6c56f60723414.tar.bz2 sharkey-dd1aa8c7d6ec003fcf187c1fc8e6c56f60723414.zip | |
stats
Diffstat (limited to 'src/api/endpoints/stats.ts')
| -rw-r--r-- | src/api/endpoints/stats.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/api/endpoints/stats.ts b/src/api/endpoints/stats.ts new file mode 100644 index 0000000000..a6084cd17a --- /dev/null +++ b/src/api/endpoints/stats.ts @@ -0,0 +1,48 @@ +/** + * Module dependencies + */ +import Post from '../models/post'; +import User from '../models/user'; + +/** + * @swagger + * /stats: + * post: + * summary: Show the misskey's statistics + * responses: + * 200: + * description: Success + * schema: + * type: object + * properties: + * posts_count: + * description: count of all posts of misskey + * type: number + * users_count: + * 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 postsCount = await Post + .count(); + + const usersCount = await User + .count(); + + res({ + posts_count: postsCount, + users_count: usersCount + }); +}); |