diff options
Diffstat (limited to 'server/controllers/api/videos/blacklist.ts')
-rw-r--r-- | server/controllers/api/videos/blacklist.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index 06333c271..d08c6e13f 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts | |||
@@ -1,6 +1,4 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | |||
3 | import { database as db } from '../../../initializers' | ||
4 | import { logger, getFormattedObjects } from '../../../helpers' | 2 | import { logger, getFormattedObjects } from '../../../helpers' |
5 | import { | 3 | import { |
6 | authenticate, | 4 | authenticate, |
@@ -13,8 +11,8 @@ import { | |||
13 | setPagination, | 11 | setPagination, |
14 | asyncMiddleware | 12 | asyncMiddleware |
15 | } from '../../../middlewares' | 13 | } from '../../../middlewares' |
16 | import { BlacklistedVideoInstance } from '../../../models' | ||
17 | import { BlacklistedVideo, UserRight } from '../../../../shared' | 14 | import { BlacklistedVideo, UserRight } from '../../../../shared' |
15 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | ||
18 | 16 | ||
19 | const blacklistRouter = express.Router() | 17 | const blacklistRouter = express.Router() |
20 | 18 | ||
@@ -57,18 +55,18 @@ async function addVideoToBlacklist (req: express.Request, res: express.Response, | |||
57 | videoId: videoInstance.id | 55 | videoId: videoInstance.id |
58 | } | 56 | } |
59 | 57 | ||
60 | await db.BlacklistedVideo.create(toCreate) | 58 | await VideoBlacklistModel.create(toCreate) |
61 | return res.type('json').status(204).end() | 59 | return res.type('json').status(204).end() |
62 | } | 60 | } |
63 | 61 | ||
64 | async function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) { | 62 | async function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) { |
65 | const resultList = await db.BlacklistedVideo.listForApi(req.query.start, req.query.count, req.query.sort) | 63 | const resultList = await VideoBlacklistModel.listForApi(req.query.start, req.query.count, req.query.sort) |
66 | 64 | ||
67 | return res.json(getFormattedObjects<BlacklistedVideo, BlacklistedVideoInstance>(resultList.data, resultList.total)) | 65 | return res.json(getFormattedObjects<BlacklistedVideo, VideoBlacklistModel>(resultList.data, resultList.total)) |
68 | } | 66 | } |
69 | 67 | ||
70 | async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) { | 68 | async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) { |
71 | const blacklistedVideo = res.locals.blacklistedVideo as BlacklistedVideoInstance | 69 | const blacklistedVideo = res.locals.blacklistedVideo as VideoBlacklistModel |
72 | 70 | ||
73 | try { | 71 | try { |
74 | await blacklistedVideo.destroy() | 72 | await blacklistedVideo.destroy() |