aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/controllers/api/videos/blacklist.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip
Move models to typescript-sequelize
Diffstat (limited to 'server/controllers/api/videos/blacklist.ts')
-rw-r--r--server/controllers/api/videos/blacklist.ts12
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 @@
1import * as express from 'express' 1import * as express from 'express'
2
3import { database as db } from '../../../initializers'
4import { logger, getFormattedObjects } from '../../../helpers' 2import { logger, getFormattedObjects } from '../../../helpers'
5import { 3import {
6 authenticate, 4 authenticate,
@@ -13,8 +11,8 @@ import {
13 setPagination, 11 setPagination,
14 asyncMiddleware 12 asyncMiddleware
15} from '../../../middlewares' 13} from '../../../middlewares'
16import { BlacklistedVideoInstance } from '../../../models'
17import { BlacklistedVideo, UserRight } from '../../../../shared' 14import { BlacklistedVideo, UserRight } from '../../../../shared'
15import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
18 16
19const blacklistRouter = express.Router() 17const 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
64async function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) { 62async 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
70async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) { 68async 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()