- body('name').optional().custom(isVideoNameValid).withMessage('Should have a valid name'),
- body('category').optional().custom(isVideoCategoryValid).withMessage('Should have a valid category'),
- body('licence').optional().custom(isVideoLicenceValid).withMessage('Should have a valid licence'),
- body('language').optional().custom(isVideoLanguageValid).withMessage('Should have a valid language'),
- body('nsfw').optional().custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'),
- body('privacy').optional().custom(isVideoPrivacyValid).withMessage('Should have correct video privacy'),
- body('description').optional().custom(isVideoDescriptionValid).withMessage('Should have a valid description'),
- body('support').optional().custom(isVideoSupportValid).withMessage('Should have a valid support text'),
- body('tags').optional().custom(isVideoTagsValid).withMessage('Should have correct tags'),
- body('commentsEnabled').optional().custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
+ body('name')
+ .optional()
+ .custom(isVideoNameValid).withMessage('Should have a valid name'),
+ body('category')
+ .optional()
+ .customSanitizer(toIntOrNull)
+ .custom(isVideoCategoryValid).withMessage('Should have a valid category'),
+ body('licence')
+ .optional()
+ .customSanitizer(toIntOrNull)
+ .custom(isVideoLicenceValid).withMessage('Should have a valid licence'),
+ body('language')
+ .optional()
+ .customSanitizer(toValueOrNull)
+ .custom(isVideoLanguageValid).withMessage('Should have a valid language'),
+ body('nsfw')
+ .optional()
+ .toBoolean()
+ .custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'),
+ body('waitTranscoding')
+ .optional()
+ .toBoolean()
+ .custom(isBooleanValid).withMessage('Should have a valid wait transcoding attribute'),
+ body('privacy')
+ .optional()
+ .toInt()
+ .custom(isVideoPrivacyValid).withMessage('Should have correct video privacy'),
+ body('description')
+ .optional()
+ .customSanitizer(toValueOrNull)
+ .custom(isVideoDescriptionValid).withMessage('Should have a valid description'),
+ body('support')
+ .optional()
+ .customSanitizer(toValueOrNull)
+ .custom(isVideoSupportValid).withMessage('Should have a valid support text'),
+ body('tags')
+ .optional()
+ .customSanitizer(toValueOrNull)
+ .custom(isVideoTagsValid).withMessage('Should have correct tags'),
+ body('commentsEnabled')
+ .optional()
+ .toBoolean()
+ .custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
+ body('channelId')
+ .optional()
+ .toInt()
+ .custom(isIdValid).withMessage('Should have correct video channel id'),
+ body('scheduleUpdate.updateAt')
+ .optional()
+ .custom(isDateValid).withMessage('Should have a valid schedule update date'),
+ body('scheduleUpdate.privacy')
+ .optional()
+ .toInt()
+ .custom(isScheduleVideoUpdatePrivacyValid).withMessage('Should have correct schedule update privacy'),