+async function addVideoToBlacklistController (req: express.Request, res: express.Response) {
+ const videoInstance = res.locals.videoAll
+ const body: VideoBlacklistCreate = req.body
+
+ await blacklistVideo(videoInstance, body)
+
+ logger.info('Video %s blacklisted.', videoInstance.uuid)
+
+ return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
+}
+
+async function updateVideoBlacklistController (req: express.Request, res: express.Response) {
+ const videoBlacklist = res.locals.videoBlacklist
+
+ if (req.body.reason !== undefined) videoBlacklist.reason = req.body.reason
+
+ await sequelizeTypescript.transaction(t => {
+ return videoBlacklist.save({ transaction: t })
+ })
+
+ return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
+}
+
+async function listBlacklist (req: express.Request, res: express.Response) {
+ const resultList = await VideoBlacklistModel.listForApi({
+ start: req.query.start,
+ count: req.query.count,
+ sort: req.query.sort,
+ search: req.query.search,
+ type: req.query.type
+ })
+
+ return res.json(getFormattedObjects(resultList.data, resultList.total))
+}
+
+async function removeVideoFromBlacklistController (req: express.Request, res: express.Response) {
+ const videoBlacklist = res.locals.videoBlacklist
+ const video = res.locals.videoAll
+
+ await unblacklistVideo(videoBlacklist, video)