diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-18 12:00:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-19 09:54:37 +0200 |
commit | 627621c1e8d37c33f7b3dd59f4c8907b12c630bc (patch) | |
tree | 007e7118f482c543d3898b222b62c185fda4fd2b /server/middlewares/validators | |
parent | e972e046dbe9b499944c4fab9220eee13e31ac1b (diff) | |
download | PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.gz PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.zst PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.zip |
Optimize SQL requests of watch page API endpoints
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/users.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/video-captions.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/video-comments.ts | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index d13c50c84..d3ba1ae23 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -172,7 +172,7 @@ const usersVideoRatingValidator = [ | |||
172 | logger.debug('Checking usersVideoRating parameters', { parameters: req.params }) | 172 | logger.debug('Checking usersVideoRating parameters', { parameters: req.params }) |
173 | 173 | ||
174 | if (areValidationErrors(req, res)) return | 174 | if (areValidationErrors(req, res)) return |
175 | if (!await isVideoExist(req.params.videoId, res)) return | 175 | if (!await isVideoExist(req.params.videoId, res, 'id')) return |
176 | 176 | ||
177 | return next() | 177 | return next() |
178 | } | 178 | } |
diff --git a/server/middlewares/validators/video-captions.ts b/server/middlewares/validators/video-captions.ts index 4f393ea84..51ffd7f3c 100644 --- a/server/middlewares/validators/video-captions.ts +++ b/server/middlewares/validators/video-captions.ts | |||
@@ -58,7 +58,7 @@ const listVideoCaptionsValidator = [ | |||
58 | logger.debug('Checking listVideoCaptions parameters', { parameters: req.params }) | 58 | logger.debug('Checking listVideoCaptions parameters', { parameters: req.params }) |
59 | 59 | ||
60 | if (areValidationErrors(req, res)) return | 60 | if (areValidationErrors(req, res)) return |
61 | if (!await isVideoExist(req.params.videoId, res)) return | 61 | if (!await isVideoExist(req.params.videoId, res, 'id')) return |
62 | 62 | ||
63 | return next() | 63 | return next() |
64 | } | 64 | } |
diff --git a/server/middlewares/validators/video-comments.ts b/server/middlewares/validators/video-comments.ts index 227bc1fca..4b15eed23 100644 --- a/server/middlewares/validators/video-comments.ts +++ b/server/middlewares/validators/video-comments.ts | |||
@@ -17,7 +17,7 @@ const listVideoCommentThreadsValidator = [ | |||
17 | logger.debug('Checking listVideoCommentThreads parameters.', { parameters: req.params }) | 17 | logger.debug('Checking listVideoCommentThreads parameters.', { parameters: req.params }) |
18 | 18 | ||
19 | if (areValidationErrors(req, res)) return | 19 | if (areValidationErrors(req, res)) return |
20 | if (!await isVideoExist(req.params.videoId, res)) return | 20 | if (!await isVideoExist(req.params.videoId, res, 'only-video')) return |
21 | 21 | ||
22 | return next() | 22 | return next() |
23 | } | 23 | } |
@@ -31,7 +31,7 @@ const listVideoThreadCommentsValidator = [ | |||
31 | logger.debug('Checking listVideoThreadComments parameters.', { parameters: req.params }) | 31 | logger.debug('Checking listVideoThreadComments parameters.', { parameters: req.params }) |
32 | 32 | ||
33 | if (areValidationErrors(req, res)) return | 33 | if (areValidationErrors(req, res)) return |
34 | if (!await isVideoExist(req.params.videoId, res)) return | 34 | if (!await isVideoExist(req.params.videoId, res, 'only-video')) return |
35 | if (!await isVideoCommentThreadExist(req.params.threadId, res.locals.video, res)) return | 35 | if (!await isVideoCommentThreadExist(req.params.threadId, res.locals.video, res)) return |
36 | 36 | ||
37 | return next() | 37 | return next() |