aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/logs.ts7
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 @@
1import express from 'express' 1import express from 'express'
2import { query } from 'express-validator' 2import { query } from 'express-validator'
3import { isStringArray } from '@server/helpers/custom-validators/search'
3import { isValidLogLevel } from '../../helpers/custom-validators/logs' 4import { isValidLogLevel } from '../../helpers/custom-validators/logs'
4import { isDateValid } from '../../helpers/custom-validators/misc' 5import { isDateValid, toArray } from '../../helpers/custom-validators/misc'
5import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
6import { areValidationErrors } from './shared' 7import { 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'),