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/middlewares/validators/video-blacklist.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/middlewares/validators/video-blacklist.ts')
-rw-r--r-- | server/middlewares/validators/video-blacklist.ts | 13 |
1 files changed, 7 insertions, 6 deletions
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { param } from 'express-validator/check' | 2 | import { param } from 'express-validator/check' |
3 | import { isIdOrUUIDValid, logger } from '../../helpers' | 3 | import { logger } from '../../helpers' |
4 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
4 | import { isVideoExist } from '../../helpers/custom-validators/videos' | 5 | import { isVideoExist } from '../../helpers/custom-validators/videos' |
5 | import { database as db } from '../../initializers/database' | 6 | import { VideoModel } from '../../models/video/video' |
6 | import { VideoInstance } from '../../models/video/video-interface' | 7 | import { VideoBlacklistModel } from '../../models/video/video-blacklist' |
7 | import { areValidationErrors } from './utils' | 8 | import { areValidationErrors } from './utils' |
8 | 9 | ||
9 | const videosBlacklistRemoveValidator = [ | 10 | const videosBlacklistRemoveValidator = [ |
@@ -42,7 +43,7 @@ export { | |||
42 | } | 43 | } |
43 | // --------------------------------------------------------------------------- | 44 | // --------------------------------------------------------------------------- |
44 | 45 | ||
45 | function checkVideoIsBlacklistable (video: VideoInstance, res: express.Response) { | 46 | function checkVideoIsBlacklistable (video: VideoModel, res: express.Response) { |
46 | if (video.isOwned() === true) { | 47 | if (video.isOwned() === true) { |
47 | res.status(403) | 48 | res.status(403) |
48 | .json({ error: 'Cannot blacklist a local video' }) | 49 | .json({ error: 'Cannot blacklist a local video' }) |
@@ -54,8 +55,8 @@ function checkVideoIsBlacklistable (video: VideoInstance, res: express.Response) | |||
54 | return true | 55 | return true |
55 | } | 56 | } |
56 | 57 | ||
57 | async function checkVideoIsBlacklisted (video: VideoInstance, res: express.Response) { | 58 | async function checkVideoIsBlacklisted (video: VideoModel, res: express.Response) { |
58 | const blacklistedVideo = await db.BlacklistedVideo.loadByVideoId(video.id) | 59 | const blacklistedVideo = await VideoBlacklistModel.loadByVideoId(video.id) |
59 | if (!blacklistedVideo) { | 60 | if (!blacklistedVideo) { |
60 | res.status(404) | 61 | res.status(404) |
61 | .send('Blacklisted video not found') | 62 | .send('Blacklisted video not found') |