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