diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-20 14:35:18 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-24 14:04:05 +0200 |
commit | d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9 (patch) | |
tree | 4305044c4a97bdf1275b241c63cb0e85151cfb6a /server/controllers/api/accounts.ts | |
parent | 57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (diff) | |
download | PeerTube-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.ts | 12 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getFormattedObjects } from '../../helpers/utils' | 2 | import { getFormattedObjects } from '../../helpers/utils' |
3 | import { | 3 | import { |
4 | asyncMiddleware, | 4 | asyncMiddleware, commonVideosFiltersValidator, |
5 | listVideoAccountChannelsValidator, | 5 | listVideoAccountChannelsValidator, |
6 | optionalAuthenticate, | 6 | optionalAuthenticate, |
7 | paginationValidator, | 7 | paginationValidator, |
@@ -11,7 +11,7 @@ import { | |||
11 | import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' | 11 | import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' |
12 | import { AccountModel } from '../../models/account/account' | 12 | import { AccountModel } from '../../models/account/account' |
13 | import { VideoModel } from '../../models/video/video' | 13 | import { VideoModel } from '../../models/video/video' |
14 | import { isNSFWHidden } from '../../helpers/express-utils' | 14 | import { buildNSFWFilter } from '../../helpers/express-utils' |
15 | import { VideoChannelModel } from '../../models/video/video-channel' | 15 | import { VideoChannelModel } from '../../models/video/video-channel' |
16 | 16 | ||
17 | const accountsRouter = express.Router() | 17 | const 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 | }) |