aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/user-notifications.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/user-notifications.ts')
-rw-r--r--server/middlewares/validators/user-notifications.ts7
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 @@
1import * as express from 'express' 1import * as express from 'express'
2import 'express-validator' 2import { body, query } from 'express-validator'
3import { body, query } from 'express-validator/check'
4import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
5import { areValidationErrors } from './utils' 4import { areValidationErrors } from './utils'
6import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' 5import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
7import { isNotEmptyIntArray } from '../../helpers/custom-validators/misc' 6import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc'
8 7
9const listUserNotificationsValidator = [ 8const 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) => {