+ const totalUsers = await db.User.countTotal()
+
+ return totalUsers < CONFIG.SIGNUP.LIMIT
+}
+
+function computeResolutionsToTranscode (videoFileHeight: number) {
+ const resolutionsEnabled: number[] = []
+ const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS
+
+ const resolutions = [
+ VideoResolution.H_240P,
+ VideoResolution.H_360P,
+ VideoResolution.H_480P,
+ VideoResolution.H_720P,
+ VideoResolution.H_1080P
+ ]
+
+ for (const resolution of resolutions) {
+ if (configResolutions[resolution.toString()] === true && videoFileHeight > resolution) {
+ resolutionsEnabled.push(resolution)
+ }
+ }
+
+ return resolutionsEnabled
+}
+
+function resetSequelizeInstance (instance: Sequelize.Instance<any>, savedFields: object) {
+ Object.keys(savedFields).forEach(key => {
+ const value = savedFields[key]
+ instance.set(key, value)