// ---------------------------------------------------------------------------
-function updateInstanceWithAnother <M, T extends U, U extends Model<M>> (instanceToUpdate: T, baseInstance: U) {
- const obj = baseInstance.toJSON()
-
- for (const key of Object.keys(obj)) {
- instanceToUpdate[key] = obj[key]
- }
-}
-
function resetSequelizeInstance <T> (instance: Model<T>) {
- instance.set(instance.previous())
+ return instance.reload()
}
function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> (
resetSequelizeInstance,
retryTransactionWrapper,
transactionRetryer,
- updateInstanceWithAnother,
afterCommitIfTransaction,
filterNonExistingModels,
deleteAllModels,