aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
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)