From 2760b454a761f6af3138b2fb5f34340772ab0d1e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 27 Oct 2021 14:37:04 +0200 Subject: Deprecate filter video query Introduce include and isLocal instead --- server/helpers/custom-validators/videos.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server/helpers/custom-validators') 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' import { values } from 'lodash' import magnetUtil from 'magnet-uri' import validator from 'validator' +import { VideoInclude } from '@shared/models' import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' import { CONSTRAINTS_FIELDS, @@ -21,6 +22,10 @@ function isVideoFilterValid (filter: VideoFilter) { return filter === 'local' || filter === 'all-local' || filter === 'all' } +function isVideoIncludeValid (include: VideoInclude) { + return exists(include) && validator.isInt('' + include) +} + function isVideoCategoryValid (value: any) { return value === null || VIDEO_CATEGORIES[value] !== undefined } @@ -146,6 +151,7 @@ export { isVideoOriginallyPublishedAtValid, isVideoMagnetUriValid, isVideoStateValid, + isVideoIncludeValid, isVideoViewsValid, isVideoRatingTypeValid, isVideoFileExtnameValid, -- cgit v1.2.3