diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/middlewares/validators/users.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-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.ts | 15 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import 'express-validator' | 2 | import 'express-validator' |
3 | import { body, param } from 'express-validator/check' | 3 | import { body, param } from 'express-validator/check' |
4 | import { isSignupAllowed, logger } from '../../helpers' | ||
5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
4 | import { | 6 | import { |
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' | ||
14 | import { isVideoExist } from '../../helpers/custom-validators/videos' | 13 | import { isVideoExist } from '../../helpers/custom-validators/videos' |
15 | import { database as db } from '../../initializers/database' | 14 | import { UserModel } from '../../models/account/user' |
16 | import { areValidationErrors } from './utils' | 15 | import { areValidationErrors } from './utils' |
17 | 16 | ||
18 | const usersAddValidator = [ | 17 | const usersAddValidator = [ |
@@ -153,7 +152,7 @@ export { | |||
153 | // --------------------------------------------------------------------------- | 152 | // --------------------------------------------------------------------------- |
154 | 153 | ||
155 | async function checkUserIdExist (id: number, res: express.Response) { | 154 | async 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 | ||
170 | async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: string, res: express.Response) { | 169 | async 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) |