]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/shared/abuses.ts
Add ability to list imports of a channel sync
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / shared / abuses.ts
CommitLineData
453e83ea 1import { Response } from 'express'
10363c74 2import { AbuseModel } from '@server/models/abuse/abuse'
c0e8b12e 3import { HttpStatusCode } from '@shared/models'
453e83ea 4
57f6896f 5async function doesAbuseExist (abuseId: number | string, res: Response) {
94148c90 6 const abuse = await AbuseModel.loadByIdWithReporter(parseInt(abuseId + '', 10))
d95d1559 7
57f6896f 8 if (!abuse) {
76148b27
RK
9 res.fail({
10 status: HttpStatusCode.NOT_FOUND_404,
11 message: 'Abuse not found'
12 })
57f6896f
C
13
14 return false
15 }
16
17 res.locals.abuse = abuse
18 return true
d95d1559
C
19}
20
453e83ea
C
21// ---------------------------------------------------------------------------
22
23export {
7a4ea932 24 doesAbuseExist
453e83ea 25}