1 import * as express from 'express'
2 import { getFormattedObjects } from '../../helpers/utils'
8 videoChannelsSortValidator
9 } from '../../middlewares'
10 import { VideoChannelModel } from '../../models/video/video-channel'
12 const videoChannelRouter = express.Router()
14 videoChannelRouter.get('/',
16 videoChannelsSortValidator,
19 asyncMiddleware(listVideoChannels)
22 // ---------------------------------------------------------------------------
28 // ---------------------------------------------------------------------------
30 async function listVideoChannels (req: express.Request, res: express.Response, next: express.NextFunction) {
31 const resultList = await VideoChannelModel.listForApi(req.query.start, req.query.count, req.query.sort)
33 return res.json(getFormattedObjects(resultList.data, resultList.total))