diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/server/stats.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/server/stats.ts b/server/controllers/api/server/stats.ts index 85803f69e..89ffd1717 100644 --- a/server/controllers/api/server/stats.ts +++ b/server/controllers/api/server/stats.ts | |||
@@ -8,6 +8,7 @@ import { VideoCommentModel } from '../../../models/video/video-comment' | |||
8 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | 8 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' |
9 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' | 9 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' |
10 | import { cacheRoute } from '../../../middlewares/cache' | 10 | import { cacheRoute } from '../../../middlewares/cache' |
11 | import { VideoFileModel } from '../../../models/video/video-file' | ||
11 | 12 | ||
12 | const statsRouter = express.Router() | 13 | const statsRouter = express.Router() |
13 | 14 | ||
@@ -16,11 +17,12 @@ statsRouter.get('/stats', | |||
16 | asyncMiddleware(getStats) | 17 | asyncMiddleware(getStats) |
17 | ) | 18 | ) |
18 | 19 | ||
19 | async function getStats (req: express.Request, res: express.Response, next: express.NextFunction) { | 20 | async function getStats (req: express.Request, res: express.Response) { |
20 | const { totalLocalVideos, totalLocalVideoViews, totalVideos } = await VideoModel.getStats() | 21 | const { totalLocalVideos, totalLocalVideoViews, totalVideos } = await VideoModel.getStats() |
21 | const { totalLocalVideoComments, totalVideoComments } = await VideoCommentModel.getStats() | 22 | const { totalLocalVideoComments, totalVideoComments } = await VideoCommentModel.getStats() |
22 | const { totalUsers } = await UserModel.getStats() | 23 | const { totalUsers } = await UserModel.getStats() |
23 | const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats() | 24 | const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats() |
25 | const { totalLocalVideoFilesSize } = await VideoFileModel.getStats() | ||
24 | 26 | ||
25 | const videosRedundancyStats = await Promise.all( | 27 | const videosRedundancyStats = await Promise.all( |
26 | CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.map(r => { | 28 | CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.map(r => { |
@@ -32,8 +34,9 @@ async function getStats (req: express.Request, res: express.Response, next: expr | |||
32 | const data: ServerStats = { | 34 | const data: ServerStats = { |
33 | totalLocalVideos, | 35 | totalLocalVideos, |
34 | totalLocalVideoViews, | 36 | totalLocalVideoViews, |
35 | totalVideos, | 37 | totalLocalVideoFilesSize, |
36 | totalLocalVideoComments, | 38 | totalLocalVideoComments, |
39 | totalVideos, | ||
37 | totalVideoComments, | 40 | totalVideoComments, |
38 | totalUsers, | 41 | totalUsers, |
39 | totalInstanceFollowers, | 42 | totalInstanceFollowers, |