From 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Dec 2017 17:53:50 +0100 Subject: Move models to typescript-sequelize --- server/middlewares/validators/video-blacklist.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'server/middlewares/validators/video-blacklist.ts') diff --git a/server/middlewares/validators/video-blacklist.ts b/server/middlewares/validators/video-blacklist.ts index f1cc04950..98099fe3f 100644 --- a/server/middlewares/validators/video-blacklist.ts +++ b/server/middlewares/validators/video-blacklist.ts @@ -1,9 +1,10 @@ import * as express from 'express' import { param } from 'express-validator/check' -import { isIdOrUUIDValid, logger } from '../../helpers' +import { logger } from '../../helpers' +import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' import { isVideoExist } from '../../helpers/custom-validators/videos' -import { database as db } from '../../initializers/database' -import { VideoInstance } from '../../models/video/video-interface' +import { VideoModel } from '../../models/video/video' +import { VideoBlacklistModel } from '../../models/video/video-blacklist' import { areValidationErrors } from './utils' const videosBlacklistRemoveValidator = [ @@ -42,7 +43,7 @@ export { } // --------------------------------------------------------------------------- -function checkVideoIsBlacklistable (video: VideoInstance, res: express.Response) { +function checkVideoIsBlacklistable (video: VideoModel, res: express.Response) { if (video.isOwned() === true) { res.status(403) .json({ error: 'Cannot blacklist a local video' }) @@ -54,8 +55,8 @@ function checkVideoIsBlacklistable (video: VideoInstance, res: express.Response) return true } -async function checkVideoIsBlacklisted (video: VideoInstance, res: express.Response) { - const blacklistedVideo = await db.BlacklistedVideo.loadByVideoId(video.id) +async function checkVideoIsBlacklisted (video: VideoModel, res: express.Response) { + const blacklistedVideo = await VideoBlacklistModel.loadByVideoId(video.id) if (!blacklistedVideo) { res.status(404) .send('Blacklisted video not found') -- cgit v1.2.3