aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-02 16:37:43 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-01-09 11:15:15 +0100
commitdc13348070d808d0ba3feb56a435b835c2e7e791 (patch)
tree887202a33f1aa680fd8ece6ee465381f3931c64e /server/middlewares
parent6e7e63b83f08ba68edc2bb9f72ff03d1802e45df (diff)
downloadPeerTube-dc13348070d808d0ba3feb56a435b835c2e7e791.tar.gz
PeerTube-dc13348070d808d0ba3feb56a435b835c2e7e791.tar.zst
PeerTube-dc13348070d808d0ba3feb56a435b835c2e7e791.zip
Add import finished and video published notifs
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/user-notifications.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/server/middlewares/validators/user-notifications.ts b/server/middlewares/validators/user-notifications.ts
index 8202f307e..1c31f0a73 100644
--- a/server/middlewares/validators/user-notifications.ts
+++ b/server/middlewares/validators/user-notifications.ts
@@ -1,11 +1,26 @@
1import * as express from 'express' 1import * as express from 'express'
2import 'express-validator' 2import 'express-validator'
3import { body } from 'express-validator/check' 3import { body, query } from 'express-validator/check'
4import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
5import { areValidationErrors } from './utils' 5import { areValidationErrors } from './utils'
6import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' 6import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
7import { isIntArray } from '../../helpers/custom-validators/misc' 7import { isIntArray } from '../../helpers/custom-validators/misc'
8 8
9const listUserNotificationsValidator = [
10 query('unread')
11 .optional()
12 .toBoolean()
13 .isBoolean().withMessage('Should have a valid unread boolean'),
14
15 (req: express.Request, res: express.Response, next: express.NextFunction) => {
16 logger.debug('Checking listUserNotificationsValidator parameters', { parameters: req.query })
17
18 if (areValidationErrors(req, res)) return
19
20 return next()
21 }
22]
23
9const updateNotificationSettingsValidator = [ 24const updateNotificationSettingsValidator = [
10 body('newVideoFromSubscription') 25 body('newVideoFromSubscription')
11 .custom(isUserNotificationSettingValid).withMessage('Should have a valid new video from subscription notification setting'), 26 .custom(isUserNotificationSettingValid).withMessage('Should have a valid new video from subscription notification setting'),
@@ -41,6 +56,7 @@ const markAsReadUserNotificationsValidator = [
41// --------------------------------------------------------------------------- 56// ---------------------------------------------------------------------------
42 57
43export { 58export {
59 listUserNotificationsValidator,
44 updateNotificationSettingsValidator, 60 updateNotificationSettingsValidator,
45 markAsReadUserNotificationsValidator 61 markAsReadUserNotificationsValidator
46} 62}