aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos/video-comments.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos/video-comments.ts')
-rw-r--r--server/middlewares/validators/videos/video-comments.ts35
1 files changed, 18 insertions, 17 deletions
diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts
index 68f41e50e..b2a39617b 100644
--- a/server/middlewares/validators/videos/video-comments.ts
+++ b/server/middlewares/validators/videos/video-comments.ts
@@ -19,28 +19,28 @@ import {
19 19
20const listVideoCommentsValidator = [ 20const listVideoCommentsValidator = [
21 query('isLocal') 21 query('isLocal')
22 .optional() 22 .optional()
23 .customSanitizer(toBooleanOrNull) 23 .customSanitizer(toBooleanOrNull)
24 .custom(isBooleanValid) 24 .custom(isBooleanValid)
25 .withMessage('Should have a valid is local boolean'), 25 .withMessage('Should have a valid isLocal boolean'),
26 26
27 query('onLocalVideo') 27 query('onLocalVideo')
28 .optional() 28 .optional()
29 .customSanitizer(toBooleanOrNull) 29 .customSanitizer(toBooleanOrNull)
30 .custom(isBooleanValid) 30 .custom(isBooleanValid)
31 .withMessage('Should have a valid is on local video boolean'), 31 .withMessage('Should have a valid onLocalVideo boolean'),
32 32
33 query('search') 33 query('search')
34 .optional() 34 .optional()
35 .custom(exists).withMessage('Should have a valid search'), 35 .custom(exists),
36 36
37 query('searchAccount') 37 query('searchAccount')
38 .optional() 38 .optional()
39 .custom(exists).withMessage('Should have a valid account search'), 39 .custom(exists),
40 40
41 query('searchVideo') 41 query('searchVideo')
42 .optional() 42 .optional()
43 .custom(exists).withMessage('Should have a valid video search'), 43 .custom(exists),
44 44
45 (req: express.Request, res: express.Response, next: express.NextFunction) => { 45 (req: express.Request, res: express.Response, next: express.NextFunction) => {
46 logger.debug('Checking listVideoCommentsValidator parameters.', { parameters: req.query }) 46 logger.debug('Checking listVideoCommentsValidator parameters.', { parameters: req.query })
@@ -70,7 +70,7 @@ const listVideoThreadCommentsValidator = [
70 isValidVideoIdParam('videoId'), 70 isValidVideoIdParam('videoId'),
71 71
72 param('threadId') 72 param('threadId')
73 .custom(isIdValid).not().isEmpty().withMessage('Should have a valid threadId'), 73 .custom(isIdValid),
74 74
75 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 75 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
76 logger.debug('Checking listVideoThreadComments parameters.', { parameters: req.params }) 76 logger.debug('Checking listVideoThreadComments parameters.', { parameters: req.params })
@@ -89,7 +89,7 @@ const addVideoCommentThreadValidator = [
89 isValidVideoIdParam('videoId'), 89 isValidVideoIdParam('videoId'),
90 90
91 body('text') 91 body('text')
92 .custom(isValidVideoCommentText).not().isEmpty().withMessage('Should have a valid comment text'), 92 .custom(isValidVideoCommentText),
93 93
94 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 94 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
95 logger.debug('Checking addVideoCommentThread parameters.', { parameters: req.params, body: req.body }) 95 logger.debug('Checking addVideoCommentThread parameters.', { parameters: req.params, body: req.body })
@@ -109,9 +109,9 @@ const addVideoCommentThreadValidator = [
109const addVideoCommentReplyValidator = [ 109const addVideoCommentReplyValidator = [
110 isValidVideoIdParam('videoId'), 110 isValidVideoIdParam('videoId'),
111 111
112 param('commentId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid commentId'), 112 param('commentId').custom(isIdValid),
113 113
114 body('text').custom(isValidVideoCommentText).not().isEmpty().withMessage('Should have a valid comment text'), 114 body('text').custom(isValidVideoCommentText),
115 115
116 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 116 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
117 logger.debug('Checking addVideoCommentReply parameters.', { parameters: req.params, body: req.body }) 117 logger.debug('Checking addVideoCommentReply parameters.', { parameters: req.params, body: req.body })
@@ -133,7 +133,7 @@ const videoCommentGetValidator = [
133 isValidVideoIdParam('videoId'), 133 isValidVideoIdParam('videoId'),
134 134
135 param('commentId') 135 param('commentId')
136 .custom(isIdValid).not().isEmpty().withMessage('Should have a valid commentId'), 136 .custom(isIdValid),
137 137
138 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 138 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
139 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params }) 139 logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
@@ -149,7 +149,8 @@ const videoCommentGetValidator = [
149const removeVideoCommentValidator = [ 149const removeVideoCommentValidator = [
150 isValidVideoIdParam('videoId'), 150 isValidVideoIdParam('videoId'),
151 151
152 param('commentId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid commentId'), 152 param('commentId')
153 .custom(isIdValid),
153 154
154 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 155 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
155 logger.debug('Checking removeVideoCommentValidator parameters.', { parameters: req.params }) 156 logger.debug('Checking removeVideoCommentValidator parameters.', { parameters: req.params })