Skip to content

Conversation

@hoan301298
Copy link
Member

Brief description

This PR adds transaction supports for Box module and apply the changes for some classes using transaction methods.
Issue: #742

Change list

  • Drop openedSession: prevents problems. Basically, a function creates a session then it owns the transaction lifecycle.
  • Add try/catch/finally: catches errors when working with MongoDB and return them easily.
  • Apply changes to the use of transaction methods in classes (Box module)
  • Add TransactionCommitError.ts, Transaction.ts.
  • ESLint

Copy link
Member

@PlayJeri PlayJeri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think the transaction helper methods can be simplified a little bit. I added more specific comments about them. Then the bigger idea behind this whole transaction support change was to implement a better Transaction ownership principle. Meaning that the method that starts / initializes the transaction must be the one that cancels or commits it. So the helper methods that take in the session shouldn't call the cancelTransaction. They only take the session as param so that the session can be passed to the BasicService so that the db operations are all under the same transaction. But the parent method is responsible for that transaction lifecycle.

And maybe consider matching naming for the transaction helpers. So initialize-, abort-, commitTransaction or Session. A bit nitpicky but might be easier to follow if all helpers are called somethingSession or somethingTransaction.

@hoan301298 hoan301298 linked an issue Jan 12, 2026 that may be closed by this pull request
@hoan301298 hoan301298 requested a review from PlayJeri January 12, 2026 22:36
Copy link
Member

@PlayJeri PlayJeri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done. Good work

@github-project-automation github-project-automation bot moved this from Backlog to Done in Altzone-Server Jan 17, 2026
@PlayJeri PlayJeri merged commit 97642e5 into dev Jan 17, 2026
4 checks passed
@PlayJeri PlayJeri deleted the feature/add-transaction-box branch January 17, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add transaction support to Box module

4 participants