aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/middlewares/video-blacklists.ts
blob: c79420a0c08a05dea8edbeba24ece1fa3945944b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Response } from 'express'
import { VideoBlacklistModel } from '../../models/video/video-blacklist'

async function doesVideoBlacklistExist (videoId: number, res: Response) {
  const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId)

  if (videoBlacklist === null) {
    res.status(404)
       .json({ error: 'Blacklisted video not found' })
       .end()

    return false
  }

  res.locals.videoBlacklist = videoBlacklist
  return true
}

// ---------------------------------------------------------------------------

export {
  doesVideoBlacklistExist
}