]>
Commit | Line | Data |
---|---|---|
1 | import { Response } from 'express' | |
2 | import { VideoAbuseModel } from '../../models/video/video-abuse' | |
3 | ||
4 | async function doesVideoAbuseExist (abuseId: number, videoId: number, res: Response) { | |
5 | const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId) | |
6 | ||
7 | if (videoAbuse === null) { | |
8 | res.status(404) | |
9 | .json({ error: 'Video abuse not found' }) | |
10 | .end() | |
11 | ||
12 | return false | |
13 | } | |
14 | ||
15 | res.locals.videoAbuse = videoAbuse | |
16 | return true | |
17 | } | |
18 | ||
19 | // --------------------------------------------------------------------------- | |
20 | ||
21 | export { | |
22 | doesVideoAbuseExist | |
23 | } |