aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index 3464341e6..cb5e536b8 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -1,9 +1,10 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as Sequelize from 'sequelize' 2import { Model } from 'sequelize-typescript'
3import { ResultList } from '../../shared' 3import { ResultList } from '../../shared'
4import { VideoResolution } from '../../shared/models/videos/video-resolution.enum' 4import { VideoResolution } from '../../shared/models/videos'
5import { CONFIG, database as db } from '../initializers' 5import { CONFIG } from '../initializers'
6import { AccountInstance } from '../models/account/account-interface' 6import { AccountModel } from '../models/account/account'
7import { UserModel } from '../models/account/user'
7import { pseudoRandomBytesPromise } from './core-utils' 8import { pseudoRandomBytesPromise } from './core-utils'
8import { logger } from './logger' 9import { logger } from './logger'
9 10
@@ -46,7 +47,7 @@ async function isSignupAllowed () {
46 return true 47 return true
47 } 48 }
48 49
49 const totalUsers = await db.User.countTotal() 50 const totalUsers = await UserModel.countTotal()
50 51
51 return totalUsers < CONFIG.SIGNUP.LIMIT 52 return totalUsers < CONFIG.SIGNUP.LIMIT
52} 53}
@@ -72,17 +73,17 @@ function computeResolutionsToTranscode (videoFileHeight: number) {
72 return resolutionsEnabled 73 return resolutionsEnabled
73} 74}
74 75
75function resetSequelizeInstance (instance: Sequelize.Instance<any>, savedFields: object) { 76function resetSequelizeInstance (instance: Model<any>, savedFields: object) {
76 Object.keys(savedFields).forEach(key => { 77 Object.keys(savedFields).forEach(key => {
77 const value = savedFields[key] 78 const value = savedFields[key]
78 instance.set(key, value) 79 instance.set(key, value)
79 }) 80 })
80} 81}
81 82
82let serverAccount: AccountInstance 83let serverAccount: AccountModel
83async function getServerAccount () { 84async function getServerAccount () {
84 if (serverAccount === undefined) { 85 if (serverAccount === undefined) {
85 serverAccount = await db.Account.loadApplication() 86 serverAccount = await AccountModel.loadApplication()
86 } 87 }
87 88
88 if (!serverAccount) { 89 if (!serverAccount) {