]>
Commit | Line | Data |
---|---|---|
3e753302 C |
1 | import { Response } from 'express' |
2 | import { VideoBlacklistModel } from '../../models/video/video-blacklist' | |
2d53be02 | 3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
3e753302 C |
4 | |
5 | async function doesVideoBlacklistExist (videoId: number, res: Response) { | |
6 | const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId) | |
7 | ||
8 | if (videoBlacklist === null) { | |
2d53be02 | 9 | res.status(HttpStatusCode.NOT_FOUND_404) |
3e753302 C |
10 | .json({ error: 'Blacklisted video not found' }) |
11 | .end() | |
12 | ||
13 | return false | |
14 | } | |
15 | ||
16 | res.locals.videoBlacklist = videoBlacklist | |
17 | return true | |
18 | } | |
19 | ||
20 | // --------------------------------------------------------------------------- | |
21 | ||
22 | export { | |
23 | doesVideoBlacklistExist | |
24 | } |