Closed konstunn closed 1 year ago
Sorry. I have missed that the domain models are mapped to the database tables via ORM mappers. So there is no need to call repository to save the changes. This work will be done by the sql alchemy orm mappers and session "automatically". Did I get it right now?
yes that's my understanding too
https://github.com/cosmicpython/code/blob/952a3d2f53ec56ca320b8415097350799f38de10/services.py#L21
If I get it right, after the allocation take place in the service and domain layers, the changes are not saved to the database, because there isn't any call to the repository before we do
session.commit()
.So our allocation seems to not have been saved and thus is not persistent. We can make the same allocation many times again and again and never run out of stock.