aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/accounts.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-20 14:35:18 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commitd525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9 (patch)
tree4305044c4a97bdf1275b241c63cb0e85151cfb6a /server/controllers/api/accounts.ts
parent57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (diff)
downloadPeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.tar.gz
PeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.tar.zst
PeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.zip
Add videos list filters
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r--server/controllers/api/accounts.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index 8e937276c..0117fc8c6 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { getFormattedObjects } from '../../helpers/utils' 2import { getFormattedObjects } from '../../helpers/utils'
3import { 3import {
4 asyncMiddleware, 4 asyncMiddleware, commonVideosFiltersValidator,
5 listVideoAccountChannelsValidator, 5 listVideoAccountChannelsValidator,
6 optionalAuthenticate, 6 optionalAuthenticate,
7 paginationValidator, 7 paginationValidator,
@@ -11,7 +11,7 @@ import {
11import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' 11import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators'
12import { AccountModel } from '../../models/account/account' 12import { AccountModel } from '../../models/account/account'
13import { VideoModel } from '../../models/video/video' 13import { VideoModel } from '../../models/video/video'
14import { isNSFWHidden } from '../../helpers/express-utils' 14import { buildNSFWFilter } from '../../helpers/express-utils'
15import { VideoChannelModel } from '../../models/video/video-channel' 15import { VideoChannelModel } from '../../models/video/video-channel'
16 16
17const accountsRouter = express.Router() 17const accountsRouter = express.Router()
@@ -36,6 +36,7 @@ accountsRouter.get('/:accountName/videos',
36 setDefaultSort, 36 setDefaultSort,
37 setDefaultPagination, 37 setDefaultPagination,
38 optionalAuthenticate, 38 optionalAuthenticate,
39 commonVideosFiltersValidator,
39 asyncMiddleware(listAccountVideos) 40 asyncMiddleware(listAccountVideos)
40) 41)
41 42
@@ -77,7 +78,12 @@ async function listAccountVideos (req: express.Request, res: express.Response, n
77 start: req.query.start, 78 start: req.query.start,
78 count: req.query.count, 79 count: req.query.count,
79 sort: req.query.sort, 80 sort: req.query.sort,
80 hideNSFW: isNSFWHidden(res), 81 categoryOneOf: req.query.categoryOneOf,
82 licenceOneOf: req.query.licenceOneOf,
83 languageOneOf: req.query.languageOneOf,
84 tagsOneOf: req.query.tagsOneOf,
85 tagsAllOf: req.query.tagsAllOf,
86 nsfw: buildNSFWFilter(res, req.query.nsfw),
81 withFiles: false, 87 withFiles: false,
82 accountId: account.id 88 accountId: account.id
83 }) 89 })