diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/helpers/custom-validators/videos.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-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.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) { |