From 1fd61899eaea245a5844e33e21f04b2562f16e5e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 May 2021 11:06:19 +0200 Subject: Add ability to filter my videos by live --- server/middlewares/validators/videos/videos.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 4d31d3dcb..bb617d77c 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -20,7 +20,7 @@ import { toIntOrNull, toValueOrNull } from '../../../helpers/custom-validators/misc' -import { isNSFWQueryValid, isNumberArray, isStringArray } from '../../../helpers/custom-validators/search' +import { isBooleanBothQueryValid, isNumberArray, isStringArray } from '../../../helpers/custom-validators/search' import { checkUserCanTerminateOwnershipChange, doesChangeVideoOwnershipExist } from '../../../helpers/custom-validators/video-ownership' import { isScheduleVideoUpdatePrivacyValid, @@ -439,7 +439,11 @@ const commonVideosFiltersValidator = [ .custom(isStringArray).withMessage('Should have a valid all of tags array'), query('nsfw') .optional() - .custom(isNSFWQueryValid).withMessage('Should have a valid NSFW attribute'), + .custom(isBooleanBothQueryValid).withMessage('Should have a valid NSFW attribute'), + query('isLive') + .optional() + .customSanitizer(toBooleanOrNull) + .custom(isBooleanValid).withMessage('Should have a valid live boolean'), query('filter') .optional() .custom(isVideoFilterValid).withMessage('Should have a valid filter attribute'), -- cgit v1.2.3