X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Faccounts.ts;h=5a1d652f237ec98c8ae178b40fe8bf4f0f5a3da2;hb=89cd12756035a146bbcc4db78cd3cd64f2f3d88d;hp=8d4db1e7537beda4bbfe6889784ee320d29b726b;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 8d4db1e75..5a1d652f2 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts @@ -16,7 +16,8 @@ import { accountNameWithHostGetValidator, accountsSortValidator, ensureAuthUserOwnsAccountValidator, - videosSortValidator + videosSortValidator, + videoChannelsSortValidator } from '../../middlewares/validators' import { AccountModel } from '../../models/account/account' import { AccountVideoRateModel } from '../../models/account/account-video-rate' @@ -56,6 +57,10 @@ accountsRouter.get('/:accountName/videos', accountsRouter.get('/:accountName/video-channels', asyncMiddleware(accountNameWithHostGetValidator), + paginationValidator, + videoChannelsSortValidator, + setDefaultSort, + setDefaultPagination, asyncMiddleware(listAccountChannels) ) @@ -108,7 +113,14 @@ async function listAccounts (req: express.Request, res: express.Response) { } async function listAccountChannels (req: express.Request, res: express.Response) { - const resultList = await VideoChannelModel.listByAccount(res.locals.account.id) + const options = { + accountId: res.locals.account.id, + start: req.query.start, + count: req.query.count, + sort: req.query.sort + } + + const resultList = await VideoChannelModel.listByAccount(options) return res.json(getFormattedObjects(resultList.data, resultList.total)) }