diff options
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/logs.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts index 03c1c4df1..901d8ca64 100644 --- a/server/middlewares/validators/logs.ts +++ b/server/middlewares/validators/logs.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import { isStringArray } from '@server/helpers/custom-validators/search' | ||
3 | import { isValidLogLevel } from '../../helpers/custom-validators/logs' | 4 | import { isValidLogLevel } from '../../helpers/custom-validators/logs' |
4 | import { isDateValid } from '../../helpers/custom-validators/misc' | 5 | import { isDateValid, toArray } from '../../helpers/custom-validators/misc' |
5 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
6 | import { areValidationErrors } from './shared' | 7 | import { areValidationErrors } from './shared' |
7 | 8 | ||
@@ -11,6 +12,10 @@ const getLogsValidator = [ | |||
11 | query('level') | 12 | query('level') |
12 | .optional() | 13 | .optional() |
13 | .custom(isValidLogLevel).withMessage('Should have a valid level'), | 14 | .custom(isValidLogLevel).withMessage('Should have a valid level'), |
15 | query('tagsOneOf') | ||
16 | .optional() | ||
17 | .customSanitizer(toArray) | ||
18 | .custom(isStringArray).withMessage('Should have a valid one of tags array'), | ||
14 | query('endDate') | 19 | query('endDate') |
15 | .optional() | 20 | .optional() |
16 | .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'), | 21 | .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'), |