X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fvideo-blacklist.ts;h=3c1ef1b4ed391ff391ab9321cf6454d3350256b2;hb=5c328e6610f451d114c30d3a3b4e5d41b3b4b612;hp=f1cc0495042127b422a0f4db2162d67277caa82b;hpb=a2431b7dcbc72c05101dcdbe631ff84a823aeb51;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/video-blacklist.ts b/server/middlewares/validators/video-blacklist.ts index f1cc04950..3c1ef1b4e 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 { 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 { logger } from '../../helpers/logger' +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')