]>
Commit | Line | Data |
---|---|---|
1 | import { Response } from 'express' | |
2 | import { AbuseModel } from '../../models/abuse/abuse' | |
3 | ||
4 | async function doesAbuseExist (abuseId: number | string, res: Response) { | |
5 | const abuse = await AbuseModel.loadByIdWithReporter(parseInt(abuseId + '', 10)) | |
6 | ||
7 | if (!abuse) { | |
8 | res.status(404) | |
9 | .json({ error: 'Abuse not found' }) | |
10 | ||
11 | return false | |
12 | } | |
13 | ||
14 | res.locals.abuse = abuse | |
15 | return true | |
16 | } | |
17 | ||
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | export { | |
21 | doesAbuseExist | |
22 | } |