returning items from sequelize transaction code example
Example: what does success transaction return in sequelize
const t = await sequelizeConfig.transaction({
autocommit: false
})
const userDeatils = await User.create({
firstName: 'Abraham',
lastName: 'Lincoln'
}, {transaction: t})
await t.commit()
return t
This return transaction(t) on success returns finished property which is 'commit' on success
So here in response we can check response.finised == 'commit
finished =='commit'
if(response.finised == 'commit){
return res.json({
code:'',
................
})