]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/helpers/middlewares/video-abuses.ts
Update server dependencies
[github/Chocobozzz/PeerTube.git] / server / helpers / middlewares / video-abuses.ts
... / ...
CommitLineData
1import { Response } from 'express'
2import { VideoAbuseModel } from '../../models/video/video-abuse'
3
4async function doesVideoAbuseExist (abuseIdArg: number | string, videoId: number, res: Response) {
5 const abuseId = parseInt(abuseIdArg + '', 10)
6 const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId)
7
8 if (videoAbuse === null) {
9 res.status(404)
10 .json({ error: 'Video abuse not found' })
11 .end()
12
13 return false
14 }
15
16 res.locals.videoAbuse = videoAbuse
17 return true
18}
19
20// ---------------------------------------------------------------------------
21
22export {
23 doesVideoAbuseExist
24}