async function updateVideo (req: express.Request, res: express.Response) {
const videoFromReq = res.locals.videoAll
- const videoFieldsSave = videoFromReq.toJSON()
const oldVideoAuditView = new VideoAuditView(videoFromReq.toFormattedDetailsJSON())
const videoInfoToUpdate: VideoUpdate = req.body
isNewVideo
})
} catch (err) {
- // Force fields we want to update
// If the transaction is retried, sequelize will think the object has not changed
- // So it will skip the SQL request, even if the last one was ROLLBACKed!
- resetSequelizeInstance(videoFromReq, videoFieldsSave)
+ // So we need to restore the previous fields
+ resetSequelizeInstance(videoFromReq)
throw err
} finally {