mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Add videos list filters
This commit is contained in:
parent
57c36b277e
commit
d525fc399a
26 changed files with 835 additions and 271 deletions
|
@ -41,6 +41,12 @@ function toValueOrNull (value: string) {
|
|||
return value
|
||||
}
|
||||
|
||||
function toArray (value: string) {
|
||||
if (value && isArray(value) === false) return [ value ]
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
function isFileValid (
|
||||
files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[],
|
||||
mimeTypeRegex: string,
|
||||
|
@ -80,5 +86,6 @@ export {
|
|||
toValueOrNull,
|
||||
isBooleanValid,
|
||||
toIntOrNull,
|
||||
toArray,
|
||||
isFileValid
|
||||
}
|
||||
|
|
19
server/helpers/custom-validators/search.ts
Normal file
19
server/helpers/custom-validators/search.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import * as validator from 'validator'
|
||||
import 'express-validator'
|
||||
|
||||
import { isArray } from './misc'
|
||||
|
||||
function isNumberArray (value: any) {
|
||||
return isArray(value) && value.every(v => validator.isInt('' + v))
|
||||
}
|
||||
|
||||
function isStringArray (value: any) {
|
||||
return isArray(value) && value.every(v => typeof v === 'string')
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isNumberArray,
|
||||
isStringArray
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue