2019-07-23 10:40:39 +02:00
|
|
|
import { Response } from 'express'
|
2021-06-03 17:33:44 +02:00
|
|
|
import { VideoBlacklistModel } from '@server/models/video/video-blacklist'
|
2021-07-16 10:42:24 +02:00
|
|
|
import { HttpStatusCode } from '@shared/models'
|
2019-07-23 10:40:39 +02:00
|
|
|
|
|
|
|
async function doesVideoBlacklistExist (videoId: number, res: Response) {
|
|
|
|
const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId)
|
|
|
|
|
|
|
|
if (videoBlacklist === null) {
|
2021-06-01 01:36:53 +02:00
|
|
|
res.fail({
|
|
|
|
status: HttpStatusCode.NOT_FOUND_404,
|
|
|
|
message: 'Blacklisted video not found'
|
|
|
|
})
|
2019-07-23 10:40:39 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
res.locals.videoBlacklist = videoBlacklist
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
doesVideoBlacklistExist
|
|
|
|
}
|