PeerTube/server/helpers/middlewares/video-channels.ts

24 lines
571 B
TypeScript
Raw Normal View History

2019-07-23 03:40:39 -05:00
import { Response } from 'express'
import { VideoAbuseModel } from '../../models/video/video-abuse'
async function doesVideoAbuseExist (abuseId: number, videoId: number, res: Response) {
const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId)
if (videoAbuse === null) {
res.status(404)
.json({ error: 'Video abuse not found' })
.end()
return false
}
res.locals.videoAbuse = videoAbuse
return true
}
// ---------------------------------------------------------------------------
export {
doesVideoAbuseExist
}