2019-07-23 03:40:39 -05:00
|
|
|
import { Response } from 'express'
|
|
|
|
import { VideoBlacklistModel } from '../../models/video/video-blacklist'
|
2020-12-07 07:32:36 -06:00
|
|
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
2019-07-23 03:40:39 -05:00
|
|
|
|
|
|
|
async function doesVideoBlacklistExist (videoId: number, res: Response) {
|
|
|
|
const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId)
|
|
|
|
|
|
|
|
if (videoBlacklist === null) {
|
2020-12-07 07:32:36 -06:00
|
|
|
res.status(HttpStatusCode.NOT_FOUND_404)
|
2019-07-23 03:40:39 -05:00
|
|
|
.json({ error: 'Blacklisted video not found' })
|
|
|
|
.end()
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
res.locals.videoBlacklist = videoBlacklist
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
doesVideoBlacklistExist
|
|
|
|
}
|