]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/database-utils.ts
note about security issue disclosures in the issue template
[github/Chocobozzz/PeerTube.git] / server / helpers / database-utils.ts
index 11304cafb684988f4c7ebedd88f7d05d0ef62290..1005d2cf19694f16e3f0cf1f000834a9c3a83972 100644 (file)
@@ -66,9 +66,17 @@ function updateInstanceWithAnother <T extends Model<T>> (instanceToUpdate: Model
   }
 }
 
+function resetSequelizeInstance (instance: Model<any>, savedFields: object) {
+  Object.keys(savedFields).forEach(key => {
+    const value = savedFields[key]
+    instance.set(key, value)
+  })
+}
+
 // ---------------------------------------------------------------------------
 
 export {
+  resetSequelizeInstance,
   retryTransactionWrapper,
   transactionRetryer,
   updateInstanceWithAnother