diff options
Diffstat (limited to 'server/middlewares/validators/shared/utils.ts')
-rw-r--r-- | server/middlewares/validators/shared/utils.ts | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/server/middlewares/validators/shared/utils.ts b/server/middlewares/validators/shared/utils.ts index 5c66ad500..8e451a24c 100644 --- a/server/middlewares/validators/shared/utils.ts +++ b/server/middlewares/validators/shared/utils.ts | |||
@@ -22,26 +22,6 @@ function areValidationErrors (req: express.Request, res: express.Response) { | |||
22 | return false | 22 | return false |
23 | } | 23 | } |
24 | 24 | ||
25 | function checkSort (sortableColumns: string[], tags: string[] = []) { | ||
26 | return [ | ||
27 | query('sort').optional().isIn(sortableColumns).withMessage('Should have correct sortable column'), | ||
28 | |||
29 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | ||
30 | logger.debug('Checking sort parameters', { parameters: req.query, tags }) | ||
31 | |||
32 | if (areValidationErrors(req, res)) return | ||
33 | |||
34 | return next() | ||
35 | } | ||
36 | ] | ||
37 | } | ||
38 | |||
39 | function createSortableColumns (sortableColumns: string[]) { | ||
40 | const sortableColumnDesc = sortableColumns.map(sortableColumn => '-' + sortableColumn) | ||
41 | |||
42 | return sortableColumns.concat(sortableColumnDesc) | ||
43 | } | ||
44 | |||
45 | function isValidVideoIdParam (paramName: string) { | 25 | function isValidVideoIdParam (paramName: string) { |
46 | return param(paramName) | 26 | return param(paramName) |
47 | .customSanitizer(toCompleteUUID) | 27 | .customSanitizer(toCompleteUUID) |
@@ -58,8 +38,6 @@ function isValidPlaylistIdParam (paramName: string) { | |||
58 | 38 | ||
59 | export { | 39 | export { |
60 | areValidationErrors, | 40 | areValidationErrors, |
61 | checkSort, | ||
62 | createSortableColumns, | ||
63 | isValidVideoIdParam, | 41 | isValidVideoIdParam, |
64 | isValidPlaylistIdParam | 42 | isValidPlaylistIdParam |
65 | } | 43 | } |