Add action hooks to user routes
[oweals/peertube.git] / server / helpers / middlewares / video-blacklists.ts
1 import { Response } from 'express'
2 import { VideoBlacklistModel } from '../../models/video/video-blacklist'
3
4 async function doesVideoBlacklistExist (videoId: number, res: Response) {
5   const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId)
6
7   if (videoBlacklist === null) {
8     res.status(404)
9        .json({ error: 'Blacklisted video not found' })
10        .end()
11
12     return false
13   }
14
15   res.locals.videoBlacklist = videoBlacklist
16   return true
17 }
18
19 // ---------------------------------------------------------------------------
20
21 export {
22   doesVideoBlacklistExist
23 }