1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Add totalLocalVideoFilesSize in stats

This commit is contained in:
Chocobozzz 2019-01-15 09:45:54 +01:00
parent 3195cd1c11
commit 44b9c0ba31
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 29 additions and 4 deletions

View file

@ -8,6 +8,7 @@ import { VideoCommentModel } from '../../../models/video/video-comment'
import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../../initializers/constants'
import { cacheRoute } from '../../../middlewares/cache'
import { VideoFileModel } from '../../../models/video/video-file'
const statsRouter = express.Router()
@ -16,11 +17,12 @@ statsRouter.get('/stats',
asyncMiddleware(getStats)
)
async function getStats (req: express.Request, res: express.Response, next: express.NextFunction) {
async function getStats (req: express.Request, res: express.Response) {
const { totalLocalVideos, totalLocalVideoViews, totalVideos } = await VideoModel.getStats()
const { totalLocalVideoComments, totalVideoComments } = await VideoCommentModel.getStats()
const { totalUsers } = await UserModel.getStats()
const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats()
const { totalLocalVideoFilesSize } = await VideoFileModel.getStats()
const videosRedundancyStats = await Promise.all(
CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.map(r => {
@ -32,8 +34,9 @@ async function getStats (req: express.Request, res: express.Response, next: expr
const data: ServerStats = {
totalLocalVideos,
totalLocalVideoViews,
totalVideos,
totalLocalVideoFilesSize,
totalLocalVideoComments,
totalVideos,
totalVideoComments,
totalUsers,
totalInstanceFollowers,