Assuming we have 2 services, A and B. Service A has a function doing the following:
- Validate the data
- Call a service B function, that makes changes to the database
- Do some more stuff
- Do changes to the database
Now, let's assume that one of the following, steps 3 or 4 failed. Since service B made changes in the database, those changes are still there.
Is there any way of rolling the database back in this case? I though about database transactions, but I couldn't find any way to do that in nest js, although it is supported by TypeOrm, it doesn't look natural to nest. If not, I am now "stuck" with the changes occured by service B, but without the changes should have happen by A.
Thanks a lot.