aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r--server/helpers/custom-validators/videos.ts19
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'
4import 'multer' 4import 'multer'
5import * as validator from 'validator' 5import * as validator from 'validator'
6import { VideoRateType } from '../../../shared' 6import { VideoRateType } from '../../../shared'
7import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_RATE_TYPES } from '../../initializers' 7import {
8import { VIDEO_PRIVACIES } from '../../initializers/constants' 8 CONSTRAINTS_FIELDS,
9import { database as db } from '../../initializers/database' 9 VIDEO_CATEGORIES,
10import { VideoInstance } from '../../models/video/video-interface' 10 VIDEO_LANGUAGES,
11 VIDEO_LICENCES,
12 VIDEO_PRIVACIES,
13 VIDEO_RATE_TYPES
14} from '../../initializers'
15import { VideoModel } from '../../models/video/video'
11import { exists, isArray } from './misc' 16import { exists, isArray } from './misc'
12 17
13const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS 18const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
@@ -100,12 +105,12 @@ function isVideoFileSizeValid (value: string) {
100} 105}
101 106
102async function isVideoExist (id: string, res: Response) { 107async 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) {