-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 (instance: Model<any>, savedFields: object) {
- Object.keys(savedFields).forEach(key => {
- instance[key] = savedFields[key]
- })