Cleanup utils helper
This commit is contained in:
parent
59c76ffa8f
commit
06215f15e0
20 changed files with 173 additions and 166 deletions
|
@ -1,6 +1,6 @@
|
|||
import * as retry from 'async/retry'
|
||||
import * as Bluebird from 'bluebird'
|
||||
import { Model, Sequelize } from 'sequelize-typescript'
|
||||
import { Model } from 'sequelize-typescript'
|
||||
import { logger } from './logger'
|
||||
|
||||
function retryTransactionWrapper <T, A, B, C> (
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue