aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/database-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/database-utils.ts')
-rw-r--r--server/helpers/database-utils.ts11
1 files changed, 1 insertions, 10 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts
index 0e6b35503..da8fb0d54 100644
--- a/server/helpers/database-utils.ts
+++ b/server/helpers/database-utils.ts
@@ -70,16 +70,8 @@ function transactionRetryer <T> (func: (err: any, data: T) => any) {
70 70
71// --------------------------------------------------------------------------- 71// ---------------------------------------------------------------------------
72 72
73function updateInstanceWithAnother <M, T extends U, U extends Model<M>> (instanceToUpdate: T, baseInstance: U) {
74 const obj = baseInstance.toJSON()
75
76 for (const key of Object.keys(obj)) {
77 instanceToUpdate[key] = obj[key]
78 }
79}
80
81function resetSequelizeInstance <T> (instance: Model<T>) { 73function resetSequelizeInstance <T> (instance: Model<T>) {
82 instance.set(instance.previous()) 74 return instance.reload()
83} 75}
84 76
85function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> ( 77function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> (
@@ -113,7 +105,6 @@ export {
113 resetSequelizeInstance, 105 resetSequelizeInstance,
114 retryTransactionWrapper, 106 retryTransactionWrapper,
115 transactionRetryer, 107 transactionRetryer,
116 updateInstanceWithAnother,
117 afterCommitIfTransaction, 108 afterCommitIfTransaction,
118 filterNonExistingModels, 109 filterNonExistingModels,
119 deleteAllModels, 110 deleteAllModels,