]>
Commit | Line | Data |
---|---|---|
453e83ea | 1 | import { Response } from 'express' |
10363c74 | 2 | import { AbuseModel } from '@server/models/abuse/abuse' |
c0e8b12e | 3 | import { HttpStatusCode } from '@shared/models' |
453e83ea | 4 | |
57f6896f | 5 | async 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 | ||
23 | export { | |
7a4ea932 | 24 | doesAbuseExist |
453e83ea | 25 | } |