diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-27 14:37:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-10-29 11:48:21 +0200 |
commit | 2760b454a761f6af3138b2fb5f34340772ab0d1e (patch) | |
tree | 2b3a2d81478f8b432eb54cce4caa5a760c494627 /server/helpers | |
parent | e4611b54910d8e7f2b4f8a97ee2d9cc8e1054127 (diff) | |
download | PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.gz PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.zst PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.zip |
Deprecate filter video query
Introduce include and isLocal instead
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 6 | ||||
-rw-r--r-- | server/helpers/query.ts | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index c3604fbad..1d56ade6f 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -2,6 +2,7 @@ import { UploadFilesForCheck } from 'express' | |||
2 | import { values } from 'lodash' | 2 | import { values } from 'lodash' |
3 | import magnetUtil from 'magnet-uri' | 3 | import magnetUtil from 'magnet-uri' |
4 | import validator from 'validator' | 4 | import validator from 'validator' |
5 | import { VideoInclude } from '@shared/models' | ||
5 | import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' | 6 | import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' |
6 | import { | 7 | import { |
7 | CONSTRAINTS_FIELDS, | 8 | CONSTRAINTS_FIELDS, |
@@ -21,6 +22,10 @@ function isVideoFilterValid (filter: VideoFilter) { | |||
21 | return filter === 'local' || filter === 'all-local' || filter === 'all' | 22 | return filter === 'local' || filter === 'all-local' || filter === 'all' |
22 | } | 23 | } |
23 | 24 | ||
25 | function isVideoIncludeValid (include: VideoInclude) { | ||
26 | return exists(include) && validator.isInt('' + include) | ||
27 | } | ||
28 | |||
24 | function isVideoCategoryValid (value: any) { | 29 | function isVideoCategoryValid (value: any) { |
25 | return value === null || VIDEO_CATEGORIES[value] !== undefined | 30 | return value === null || VIDEO_CATEGORIES[value] !== undefined |
26 | } | 31 | } |
@@ -146,6 +151,7 @@ export { | |||
146 | isVideoOriginallyPublishedAtValid, | 151 | isVideoOriginallyPublishedAtValid, |
147 | isVideoMagnetUriValid, | 152 | isVideoMagnetUriValid, |
148 | isVideoStateValid, | 153 | isVideoStateValid, |
154 | isVideoIncludeValid, | ||
149 | isVideoViewsValid, | 155 | isVideoViewsValid, |
150 | isVideoRatingTypeValid, | 156 | isVideoRatingTypeValid, |
151 | isVideoFileExtnameValid, | 157 | isVideoFileExtnameValid, |
diff --git a/server/helpers/query.ts b/server/helpers/query.ts index e711b15f2..79cf076d1 100644 --- a/server/helpers/query.ts +++ b/server/helpers/query.ts | |||
@@ -18,8 +18,10 @@ function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) { | |||
18 | 'languageOneOf', | 18 | 'languageOneOf', |
19 | 'tagsOneOf', | 19 | 'tagsOneOf', |
20 | 'tagsAllOf', | 20 | 'tagsAllOf', |
21 | 'filter', | 21 | 'isLocal', |
22 | 'skipCount' | 22 | 'include', |
23 | 'skipCount', | ||
24 | 'search' | ||
23 | ]) | 25 | ]) |
24 | } | 26 | } |
25 | 27 | ||
@@ -29,7 +31,6 @@ function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) { | |||
29 | 31 | ||
30 | ...pick(query, [ | 32 | ...pick(query, [ |
31 | 'searchTarget', | 33 | 'searchTarget', |
32 | 'search', | ||
33 | 'host', | 34 | 'host', |
34 | 'startDate', | 35 | 'startDate', |
35 | 'endDate', | 36 | 'endDate', |