diff options
Diffstat (limited to 'server/middlewares/validators/user-subscriptions.ts')
-rw-r--r-- | server/middlewares/validators/user-subscriptions.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/middlewares/validators/user-subscriptions.ts b/server/middlewares/validators/user-subscriptions.ts index 5d4cc94c5..a54ecb704 100644 --- a/server/middlewares/validators/user-subscriptions.ts +++ b/server/middlewares/validators/user-subscriptions.ts | |||
@@ -7,6 +7,18 @@ import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-v | |||
7 | import { toArray } from '../../helpers/custom-validators/misc' | 7 | import { toArray } from '../../helpers/custom-validators/misc' |
8 | import { WEBSERVER } from '../../initializers/constants' | 8 | import { WEBSERVER } from '../../initializers/constants' |
9 | 9 | ||
10 | const userSubscriptionListValidator = [ | ||
11 | query('search').optional().not().isEmpty().withMessage('Should have a valid search'), | ||
12 | |||
13 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
14 | logger.debug('Checking userSubscriptionListValidator parameters', { parameters: req.query }) | ||
15 | |||
16 | if (areValidationErrors(req, res)) return | ||
17 | |||
18 | return next() | ||
19 | } | ||
20 | ] | ||
21 | |||
10 | const userSubscriptionAddValidator = [ | 22 | const userSubscriptionAddValidator = [ |
11 | body('uri').custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'), | 23 | body('uri').custom(isValidActorHandle).withMessage('Should have a valid URI to follow (username@domain)'), |
12 | 24 | ||
@@ -64,6 +76,7 @@ const userSubscriptionGetValidator = [ | |||
64 | 76 | ||
65 | export { | 77 | export { |
66 | areSubscriptionsExistValidator, | 78 | areSubscriptionsExistValidator, |
79 | userSubscriptionListValidator, | ||
67 | userSubscriptionAddValidator, | 80 | userSubscriptionAddValidator, |
68 | userSubscriptionGetValidator | 81 | userSubscriptionGetValidator |
69 | } | 82 | } |