diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-03-29 14:51:06 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-29 14:51:06 +0900 |
| commit | 0b5597c873d2d9d45be94a18e1b74f44d9925185 (patch) | |
| tree | 8b4dac3a56cf703650c8207f9279028a8560a96b /src/server/api/endpoints/stats.ts | |
| parent | oops (diff) | |
| parent | Resolve conflicts (diff) | |
| download | misskey-0b5597c873d2d9d45be94a18e1b74f44d9925185.tar.gz misskey-0b5597c873d2d9d45be94a18e1b74f44d9925185.tar.bz2 misskey-0b5597c873d2d9d45be94a18e1b74f44d9925185.zip | |
Merge pull request #1332 from syuilo/pr/1327
Pr/1327
Diffstat (limited to 'src/server/api/endpoints/stats.ts')
| -rw-r--r-- | src/server/api/endpoints/stats.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts new file mode 100644 index 0000000000..719792d40d --- /dev/null +++ b/src/server/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: + * postsCount: + * description: count of all posts 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 postsCount = await Post + .count(); + + const usersCount = await User + .count(); + + res({ + postsCount: postsCount, + usersCount: usersCount + }); +}); |