diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-10 10:02:18 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-10 10:18:16 +0200 |
commit | 35bf0c83c80f59ca79f4b84fac8700f17adeb22d (patch) | |
tree | a9b2106096d6ba04d7219051b17fd32cfbe6a885 /server/middlewares/validators/blacklist.ts | |
parent | 769d332177a5b02d5c2ffc134687d3b4ed65bae9 (diff) | |
download | PeerTube-35bf0c83c80f59ca79f4b84fac8700f17adeb22d.tar.gz PeerTube-35bf0c83c80f59ca79f4b84fac8700f17adeb22d.tar.zst PeerTube-35bf0c83c80f59ca79f4b84fac8700f17adeb22d.zip |
Video blacklist refractoring
Diffstat (limited to 'server/middlewares/validators/blacklist.ts')
-rw-r--r-- | server/middlewares/validators/blacklist.ts | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/server/middlewares/validators/blacklist.ts b/server/middlewares/validators/blacklist.ts deleted file mode 100644 index fe8fa40a4..000000000 --- a/server/middlewares/validators/blacklist.ts +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | import { param } from 'express-validator/check' | ||
2 | import * as express from 'express' | ||
3 | |||
4 | import { database as db } from '../../initializers/database' | ||
5 | import { checkErrors } from './utils' | ||
6 | import { logger } from '../../helpers' | ||
7 | |||
8 | const blacklistRemoveValidator = [ | ||
9 | param('id').isNumeric().not().isEmpty().withMessage('Should have a valid id'), | ||
10 | |||
11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
12 | logger.debug('Checking blacklistRemove parameters.', { parameters: req.params }) | ||
13 | |||
14 | checkErrors(req, res, () => { | ||
15 | db.BlacklistedVideo.loadById(req.params.id) | ||
16 | .then(entry => { | ||
17 | if (!entry) return res.status(404).send('Blacklisted video not found') | ||
18 | |||
19 | res.locals.blacklistEntryToRemove = entry | ||
20 | |||
21 | next() | ||
22 | }) | ||
23 | .catch(err => { | ||
24 | logger.error('Error in blacklistRemove request validator', { error: err }) | ||
25 | return res.sendStatus(500) | ||
26 | }) | ||
27 | }) | ||
28 | } | ||
29 | ] | ||
30 | |||
31 | // --------------------------------------------------------------------------- | ||
32 | |||
33 | export { | ||
34 | blacklistRemoveValidator | ||
35 | } | ||