diff options
Diffstat (limited to 'server/middlewares/validators/user-history.ts')
-rw-r--r-- | server/middlewares/validators/user-history.ts | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/server/middlewares/validators/user-history.ts b/server/middlewares/validators/user-history.ts deleted file mode 100644 index f2dae3134..000000000 --- a/server/middlewares/validators/user-history.ts +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | import express from 'express' | ||
2 | import { body, param, query } from 'express-validator' | ||
3 | import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc' | ||
4 | import { areValidationErrors } from './shared' | ||
5 | |||
6 | const userHistoryListValidator = [ | ||
7 | query('search') | ||
8 | .optional() | ||
9 | .custom(exists), | ||
10 | |||
11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
12 | if (areValidationErrors(req, res)) return | ||
13 | |||
14 | return next() | ||
15 | } | ||
16 | ] | ||
17 | |||
18 | const userHistoryRemoveAllValidator = [ | ||
19 | body('beforeDate') | ||
20 | .optional() | ||
21 | .custom(isDateValid).withMessage('Should have a before date that conforms to ISO 8601'), | ||
22 | |||
23 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
24 | if (areValidationErrors(req, res)) return | ||
25 | |||
26 | return next() | ||
27 | } | ||
28 | ] | ||
29 | |||
30 | const userHistoryRemoveElementValidator = [ | ||
31 | param('videoId') | ||
32 | .custom(isIdValid), | ||
33 | |||
34 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
35 | if (areValidationErrors(req, res)) return | ||
36 | |||
37 | return next() | ||
38 | } | ||
39 | ] | ||
40 | |||
41 | // --------------------------------------------------------------------------- | ||
42 | |||
43 | export { | ||
44 | userHistoryListValidator, | ||
45 | userHistoryRemoveElementValidator, | ||
46 | userHistoryRemoveAllValidator | ||
47 | } | ||