diff options
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 37fa8b08a..ee9d0ed19 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -4,10 +4,15 @@ import { values } from 'lodash' | |||
4 | import 'multer' | 4 | import 'multer' |
5 | import * as validator from 'validator' | 5 | import * as validator from 'validator' |
6 | import { VideoRateType } from '../../../shared' | 6 | import { VideoRateType } from '../../../shared' |
7 | import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_RATE_TYPES } from '../../initializers' | 7 | import { |
8 | import { VIDEO_PRIVACIES } from '../../initializers/constants' | 8 | CONSTRAINTS_FIELDS, |
9 | import { database as db } from '../../initializers/database' | 9 | VIDEO_CATEGORIES, |
10 | import { VideoInstance } from '../../models/video/video-interface' | 10 | VIDEO_LANGUAGES, |
11 | VIDEO_LICENCES, | ||
12 | VIDEO_PRIVACIES, | ||
13 | VIDEO_RATE_TYPES | ||
14 | } from '../../initializers' | ||
15 | import { VideoModel } from '../../models/video/video' | ||
11 | import { exists, isArray } from './misc' | 16 | import { exists, isArray } from './misc' |
12 | 17 | ||
13 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS | 18 | const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS |
@@ -100,12 +105,12 @@ function isVideoFileSizeValid (value: string) { | |||
100 | } | 105 | } |
101 | 106 | ||
102 | async function isVideoExist (id: string, res: Response) { | 107 | async function isVideoExist (id: string, res: Response) { |
103 | let video: VideoInstance | 108 | let video: VideoModel |
104 | 109 | ||
105 | if (validator.isInt(id)) { | 110 | if (validator.isInt(id)) { |
106 | video = await db.Video.loadAndPopulateAccountAndServerAndTags(+id) | 111 | video = await VideoModel.loadAndPopulateAccountAndServerAndTags(+id) |
107 | } else { // UUID | 112 | } else { // UUID |
108 | video = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(id) | 113 | video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(id) |
109 | } | 114 | } |
110 | 115 | ||
111 | if (!video) { | 116 | if (!video) { |