aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/helpers/custom-validators/videos.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip
Move models to typescript-sequelize
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) {