aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-15 11:53:26 +0200
committerChocobozzz <me@florianbigard.com>2019-08-19 17:26:35 +0200
commit453e83ea5d81d203ba34bc43cd5c2c750ba40568 (patch)
tree604e02f4343d13a4ba42e1fb7527ba6ab9111712 /server/middlewares/validators/users.ts
parent13176a07a95984a53cc59aec5217f2ce9806d1bc (diff)
downloadPeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.gz
PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.zst
PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.zip
Stronger model typings
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index 16d297047..40dd0f0e9 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -2,7 +2,7 @@ import * as Bluebird from 'bluebird'
2import * as express from 'express' 2import * as express from 'express'
3import { body, param } from 'express-validator' 3import { body, param } from 'express-validator'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' 5import { isIdOrUUIDValid, toBooleanOrNull } from '../../helpers/custom-validators/misc'
6import { 6import {
7 isUserAdminFlagsValid, 7 isUserAdminFlagsValid,
8 isUserAutoPlayVideoValid, 8 isUserAutoPlayVideoValid,
@@ -31,6 +31,7 @@ import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
31import { isThemeRegistered } from '../../lib/plugins/theme-utils' 31import { isThemeRegistered } from '../../lib/plugins/theme-utils'
32import { doesVideoExist } from '../../helpers/middlewares' 32import { doesVideoExist } from '../../helpers/middlewares'
33import { UserRole } from '../../../shared/models/users' 33import { UserRole } from '../../../shared/models/users'
34import { MUserDefault } from '@server/typings/models'
34 35
35const usersAddValidator = [ 36const usersAddValidator = [
36 body('username').custom(isUserUsernameValid).withMessage('Should have a valid username (lowercase alphanumeric characters)'), 37 body('username').custom(isUserUsernameValid).withMessage('Should have a valid username (lowercase alphanumeric characters)'),
@@ -457,7 +458,7 @@ async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email:
457 return true 458 return true
458} 459}
459 460
460async function checkUserExist (finder: () => Bluebird<UserModel>, res: express.Response, abortResponse = true) { 461async function checkUserExist (finder: () => Bluebird<MUserDefault>, res: express.Response, abortResponse = true) {
461 const user = await finder() 462 const user = await finder()
462 463
463 if (!user) { 464 if (!user) {