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