aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-20 14:23:32 +0200
committerChocobozzz <me@florianbigard.com>2021-10-20 14:33:38 +0200
commit64553e8809271df1113e9143426a27f234410a74 (patch)
treebeba7a8d4016b74dd3b85e8081482a3ea6d00eaf /server/middlewares/validators
parent1243729899082a71b3a3efb759df1478d9ea5c83 (diff)
downloadPeerTube-64553e8809271df1113e9143426a27f234410a74.tar.gz
PeerTube-64553e8809271df1113e9143426a27f234410a74.tar.zst
PeerTube-64553e8809271df1113e9143426a27f234410a74.zip
Add ability to filter logs by tags
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'),