diff options
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r-- | server/middlewares/validators/users.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index e0d1d917a..b7b9ef370 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -1,8 +1,11 @@ | |||
1 | import 'express-validator' | ||
2 | import * as express from 'express' | ||
3 | |||
1 | import { database as db } from '../../initializers/database' | 4 | import { database as db } from '../../initializers/database' |
2 | import { checkErrors } from './utils' | 5 | import { checkErrors } from './utils' |
3 | import { logger } from '../../helpers' | 6 | import { logger } from '../../helpers' |
4 | 7 | ||
5 | function usersAddValidator (req, res, next) { | 8 | function usersAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
6 | req.checkBody('username', 'Should have a valid username').isUserUsernameValid() | 9 | req.checkBody('username', 'Should have a valid username').isUserUsernameValid() |
7 | req.checkBody('password', 'Should have a valid password').isUserPasswordValid() | 10 | req.checkBody('password', 'Should have a valid password').isUserPasswordValid() |
8 | req.checkBody('email', 'Should have a valid email').isEmail() | 11 | req.checkBody('email', 'Should have a valid email').isEmail() |
@@ -23,7 +26,7 @@ function usersAddValidator (req, res, next) { | |||
23 | }) | 26 | }) |
24 | } | 27 | } |
25 | 28 | ||
26 | function usersRemoveValidator (req, res, next) { | 29 | function usersRemoveValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
27 | req.checkParams('id', 'Should have a valid id').notEmpty().isInt() | 30 | req.checkParams('id', 'Should have a valid id').notEmpty().isInt() |
28 | 31 | ||
29 | logger.debug('Checking usersRemove parameters', { parameters: req.params }) | 32 | logger.debug('Checking usersRemove parameters', { parameters: req.params }) |
@@ -44,7 +47,7 @@ function usersRemoveValidator (req, res, next) { | |||
44 | }) | 47 | }) |
45 | } | 48 | } |
46 | 49 | ||
47 | function usersUpdateValidator (req, res, next) { | 50 | function usersUpdateValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
48 | req.checkParams('id', 'Should have a valid id').notEmpty().isInt() | 51 | req.checkParams('id', 'Should have a valid id').notEmpty().isInt() |
49 | // Add old password verification | 52 | // Add old password verification |
50 | req.checkBody('password', 'Should have a valid password').optional().isUserPasswordValid() | 53 | req.checkBody('password', 'Should have a valid password').optional().isUserPasswordValid() |
@@ -55,7 +58,7 @@ function usersUpdateValidator (req, res, next) { | |||
55 | checkErrors(req, res, next) | 58 | checkErrors(req, res, next) |
56 | } | 59 | } |
57 | 60 | ||
58 | function usersVideoRatingValidator (req, res, next) { | 61 | function usersVideoRatingValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
59 | req.checkParams('videoId', 'Should have a valid video id').notEmpty().isUUID(4) | 62 | req.checkParams('videoId', 'Should have a valid video id').notEmpty().isUUID(4) |
60 | 63 | ||
61 | logger.debug('Checking usersVideoRating parameters', { parameters: req.params }) | 64 | logger.debug('Checking usersVideoRating parameters', { parameters: req.params }) |