mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Server: reorganize express validators
This commit is contained in:
parent
e62f6ef741
commit
e4c556196d
8 changed files with 100 additions and 52 deletions
18
server/helpers/custom-validators/users.js
Normal file
18
server/helpers/custom-validators/users.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
'use strict'
|
||||
|
||||
const validator = require('express-validator').validator
|
||||
|
||||
const constants = require('../../initializers/constants')
|
||||
const USERS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.USERS
|
||||
|
||||
const usersValidators = {
|
||||
isUserUsernameValid: isUserUsernameValid
|
||||
}
|
||||
|
||||
function isUserUsernameValid (value) {
|
||||
return validator.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = usersValidators
|
Loading…
Add table
Add a link
Reference in a new issue