Skip to content

fix(teams): wrap updateSplits delete and save in database transaction (#375) - #380

Open
PINYOPATTANAWASANPORN wants to merge 1 commit into
MergeFi:mainfrom
PINYOPATTANAWASANPORN:fix/transactional-update-splits-375
Open

PINYOPATTANAWASANPORN wants to merge 1 commit into
MergeFi:mainfrom
PINYOPATTANAWASANPORN:fix/transactional-update-splits-375

Conversation

@PINYOPATTANAWASANPORN

Copy link
Copy Markdown

Summary of Changes

  • Wraps the member split replacement in TeamsService.updateSplits (src/teams/teams.service.ts) inside a database transaction via this.dataSource.transaction.
  • Ensures that if inserting the new splits fails for any reason (constraint failure, connection drop, timeout), the deletion of the existing splits is rolled back, preventing the team from being left in a corrupted zero-split state.
  • Adds comprehensive unit test coverage in src/teams/teams.service.spec.ts validating transactional isolation, validation ordering, and entity creation.

Root Cause / Technical Context

Verification & Testing

  • Surgical 2-file diff against upstream main (a89df16).
  • Preserved strict Unix LF line endings.
  • Added 3 unit tests in teams.service.spec.ts:
    1. Percentage validation failure rejects before entering the transaction.
    2. Successful replacement calls delete and save inside dataSource.transaction.
    3. Missing team throws NotFoundException before entering the transaction.

Impact & Compatibility

  • Breaking changes: None.
  • Dependencies affected: Injects DataSource into TeamsService using existing NestJS/TypeORM container bindings.

@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

@PINYOPATTANAWASANPORN is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@PINYOPATTANAWASANPORN
PINYOPATTANAWASANPORN force-pushed the fix/transactional-update-splits-375 branch from 4387b01 to 590496a Compare September 28, 2026 06:09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant