aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/middlewares/validators/users.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip
Move models to typescript-sequelize
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index ac7435b7d..920176d07 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -1,18 +1,17 @@
1import * as express from 'express' 1import * as express from 'express'
2import 'express-validator' 2import 'express-validator'
3import { body, param } from 'express-validator/check' 3import { body, param } from 'express-validator/check'
4import { isSignupAllowed, logger } from '../../helpers'
5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
4import { 6import {
5 isIdOrUUIDValid,
6 isSignupAllowed,
7 isUserDisplayNSFWValid, 7 isUserDisplayNSFWValid,
8 isUserPasswordValid, 8 isUserPasswordValid,
9 isUserRoleValid, 9 isUserRoleValid,
10 isUserUsernameValid, 10 isUserUsernameValid,
11 isUserVideoQuotaValid, 11 isUserVideoQuotaValid
12 logger 12} from '../../helpers/custom-validators/users'
13} from '../../helpers'
14import { isVideoExist } from '../../helpers/custom-validators/videos' 13import { isVideoExist } from '../../helpers/custom-validators/videos'
15import { database as db } from '../../initializers/database' 14import { UserModel } from '../../models/account/user'
16import { areValidationErrors } from './utils' 15import { areValidationErrors } from './utils'
17 16
18const usersAddValidator = [ 17const usersAddValidator = [
@@ -153,7 +152,7 @@ export {
153// --------------------------------------------------------------------------- 152// ---------------------------------------------------------------------------
154 153
155async function checkUserIdExist (id: number, res: express.Response) { 154async function checkUserIdExist (id: number, res: express.Response) {
156 const user = await db.User.loadById(id) 155 const user = await UserModel.loadById(id)
157 156
158 if (!user) { 157 if (!user) {
159 res.status(404) 158 res.status(404)
@@ -168,7 +167,7 @@ async function checkUserIdExist (id: number, res: express.Response) {
168} 167}
169 168
170async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: string, res: express.Response) { 169async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: string, res: express.Response) {
171 const user = await db.User.loadByUsernameOrEmail(username, email) 170 const user = await UserModel.loadByUsernameOrEmail(username, email)
172 171
173 if (user) { 172 if (user) {
174 res.status(409) 173 res.status(409)