diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-20 14:23:32 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-20 14:33:38 +0200 |
commit | 64553e8809271df1113e9143426a27f234410a74 (patch) | |
tree | beba7a8d4016b74dd3b85e8081482a3ea6d00eaf /server/middlewares/validators | |
parent | 1243729899082a71b3a3efb759df1478d9ea5c83 (diff) | |
download | PeerTube-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.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'), |