aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-25 11:55:06 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-26 09:11:38 +0200
commiteb08047657e739bcd9e592d76307befa3998482b (patch)
treefc309f51ece792fd4307c4af510710a853e1d6b2 /server/helpers/utils.ts
parent5f04dd2f743961e0a06c29531cc3ccc9e4928d56 (diff)
downloadPeerTube-eb08047657e739bcd9e592d76307befa3998482b.tar.gz
PeerTube-eb08047657e739bcd9e592d76307befa3998482b.tar.zst
PeerTube-eb08047657e739bcd9e592d76307befa3998482b.zip
Use async/await in controllers
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index 3317dddc3..6cabe117c 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -1,4 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 3import * as Promise from 'bluebird'
3 4
4import { pseudoRandomBytesPromise } from './core-utils' 5import { pseudoRandomBytesPromise } from './core-utils'
@@ -69,6 +70,13 @@ function computeResolutionsToTranscode (videoFileHeight: number) {
69 return resolutionsEnabled 70 return resolutionsEnabled
70} 71}
71 72
73function resetSequelizeInstance (instance: Sequelize.Instance<any>, savedFields: object) {
74 Object.keys(savedFields).forEach(key => {
75 const value = savedFields[key]
76 instance.set(key, value)
77 })
78}
79
72type SortType = { sortModel: any, sortValue: string } 80type SortType = { sortModel: any, sortValue: string }
73 81
74// --------------------------------------------------------------------------- 82// ---------------------------------------------------------------------------
@@ -79,5 +87,6 @@ export {
79 getFormattedObjects, 87 getFormattedObjects,
80 isSignupAllowed, 88 isSignupAllowed,
81 computeResolutionsToTranscode, 89 computeResolutionsToTranscode,
90 resetSequelizeInstance,
82 SortType 91 SortType
83} 92}