zakodium / adonis-mongodb

MongoDB provider for AdonisJS 5
https://zakodium.github.io/adonis-mongodb/
Other
64 stars 12 forks source link

feat: add `useTransaction` to BaseModel #151

Closed tpoisseau closed 11 months ago

tpoisseau commented 11 months ago

As view on discord, I purpose the useTransaction on model like Lucid API. And I add the transaction shortcut on Database. transaction API on connection support options.

I will need to add some test cases also maybe (around transaction)

targos commented 11 months ago
tpoisseau commented 11 months ago

after check test to adapt, it's because of snapshot usage.

So, I sorted the query so firstOrFail is stable. But we will need to reset snapshots on github, do you know how to do it ?

Also I added a property in toJSON ($isTransaction) maybe I should not ?

targos commented 11 months ago

The snapshots are committed in the repo. You need to reset them locally (the error output tells you how to do it)

codecov-commenter commented 11 months ago

Codecov Report

Patch coverage is 68.42% of modified lines.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Changed Coverage
src/Model/Model.ts 57.14%
src/Database/Connection.ts 100.00%
src/Database/Database.ts 100.00%

:loudspeaker: Thoughts on this report? Let us know!.