1 import * as express from 'express'
3 import { database as db } from '../../../initializers/database'
4 import { logger } from '../../../helpers'
8 videosBlacklistValidator
9 } from '../../../middlewares'
11 const blacklistRouter = express.Router()
13 blacklistRouter.post('/:id/blacklist',
16 videosBlacklistValidator,
20 // ---------------------------------------------------------------------------
26 // ---------------------------------------------------------------------------
28 function addVideoToBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) {
29 const videoInstance = res.locals.video
32 videoId: videoInstance.id
35 db.BlacklistedVideo.create(toCreate)
36 .then(() => res.type('json').status(204).end())
38 logger.error('Errors when blacklisting video ', { error: err })