aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/videos/video-view.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/videos/video-view.ts')
-rw-r--r--server/middlewares/validators/videos/video-view.ts7
1 files changed, 1 insertions, 6 deletions
diff --git a/server/middlewares/validators/videos/video-view.ts b/server/middlewares/validators/videos/video-view.ts
index 4927c04ad..6e2d4505d 100644
--- a/server/middlewares/validators/videos/video-view.ts
+++ b/server/middlewares/validators/videos/video-view.ts
@@ -1,20 +1,17 @@
1import express from 'express' 1import express from 'express'
2import { body, param } from 'express-validator' 2import { body, param } from 'express-validator'
3import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view' 3import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view'
4import { getCachedVideoDuration } from '@server/lib/video'
4import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer' 5import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'
5import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
6import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' 7import { exists, isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
7import { logger } from '../../../helpers/logger'
8import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' 8import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
9import { getCachedVideoDuration } from '@server/lib/video'
10 9
11const getVideoLocalViewerValidator = [ 10const getVideoLocalViewerValidator = [
12 param('localViewerId') 11 param('localViewerId')
13 .custom(isIdValid), 12 .custom(isIdValid),
14 13
15 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 14 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
16 logger.debug('Checking getVideoLocalViewerValidator parameters', { parameters: req.params })
17
18 if (areValidationErrors(req, res)) return 15 if (areValidationErrors(req, res)) return
19 16
20 const localViewer = await LocalVideoViewerModel.loadFullById(+req.params.localViewerId) 17 const localViewer = await LocalVideoViewerModel.loadFullById(+req.params.localViewerId)
@@ -40,8 +37,6 @@ const videoViewValidator = [
40 .custom(isIntOrNull), 37 .custom(isIntOrNull),
41 38
42 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 39 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
43 logger.debug('Checking videoView parameters', { parameters: req.body })
44
45 if (areValidationErrors(req, res)) return 40 if (areValidationErrors(req, res)) return
46 if (!await doesVideoExist(req.params.videoId, res, 'only-immutable-attributes')) return 41 if (!await doesVideoExist(req.params.videoId, res, 'only-immutable-attributes')) return
47 42