diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-25 16:23:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-07-25 16:23:44 +0200 |
commit | c8861d5dc0436ef4342ce517241e3591fa256a13 (patch) | |
tree | ca47c09d1f7f1e2aa62c684d576faa938eb47af7 /server/middlewares/validators/user-notifications.ts | |
parent | b4c19345c19b0891142c69308cd9447f2161188c (diff) | |
download | PeerTube-c8861d5dc0436ef4342ce517241e3591fa256a13.tar.gz PeerTube-c8861d5dc0436ef4342ce517241e3591fa256a13.tar.zst PeerTube-c8861d5dc0436ef4342ce517241e3591fa256a13.zip |
Fix express validator
Diffstat (limited to 'server/middlewares/validators/user-notifications.ts')
-rw-r--r-- | server/middlewares/validators/user-notifications.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/middlewares/validators/user-notifications.ts b/server/middlewares/validators/user-notifications.ts index 3ded8d8cf..308b32655 100644 --- a/server/middlewares/validators/user-notifications.ts +++ b/server/middlewares/validators/user-notifications.ts | |||
@@ -1,15 +1,14 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import 'express-validator' | 2 | import { body, query } from 'express-validator' |
3 | import { body, query } from 'express-validator/check' | ||
4 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
5 | import { areValidationErrors } from './utils' | 4 | import { areValidationErrors } from './utils' |
6 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' | 5 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' |
7 | import { isNotEmptyIntArray } from '../../helpers/custom-validators/misc' | 6 | import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc' |
8 | 7 | ||
9 | const listUserNotificationsValidator = [ | 8 | const listUserNotificationsValidator = [ |
10 | query('unread') | 9 | query('unread') |
11 | .optional() | 10 | .optional() |
12 | .toBoolean() | 11 | .customSanitizer(toBooleanOrNull) |
13 | .isBoolean().withMessage('Should have a valid unread boolean'), | 12 | .isBoolean().withMessage('Should have a valid unread boolean'), |
14 | 13 | ||
15 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 14 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |