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/controllers/api/videos/blacklist.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'server/controllers/api/videos/blacklist.ts') 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 @@ import * as express from 'express' - -import { database as db } from '../../../initializers' import { logger, getFormattedObjects } from '../../../helpers' import { authenticate, @@ -13,8 +11,8 @@ import { setPagination, asyncMiddleware } from '../../../middlewares' -import { BlacklistedVideoInstance } from '../../../models' import { BlacklistedVideo, UserRight } from '../../../../shared' +import { VideoBlacklistModel } from '../../../models/video/video-blacklist' const blacklistRouter = express.Router() @@ -57,18 +55,18 @@ async function addVideoToBlacklist (req: express.Request, res: express.Response, videoId: videoInstance.id } - await db.BlacklistedVideo.create(toCreate) + await VideoBlacklistModel.create(toCreate) return res.type('json').status(204).end() } async function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) { - const resultList = await db.BlacklistedVideo.listForApi(req.query.start, req.query.count, req.query.sort) + const resultList = await VideoBlacklistModel.listForApi(req.query.start, req.query.count, req.query.sort) - return res.json(getFormattedObjects(resultList.data, resultList.total)) + return res.json(getFormattedObjects(resultList.data, resultList.total)) } async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) { - const blacklistedVideo = res.locals.blacklistedVideo as BlacklistedVideoInstance + const blacklistedVideo = res.locals.blacklistedVideo as VideoBlacklistModel try { await blacklistedVideo.destroy() -- cgit v1.2.3