Skip to content

refactor: move transaction commit from repository to service layer#116

Merged
Besthope-Official merged 1 commit into
mainfrom
fix/audit-log-commit
Feb 3, 2026
Merged

refactor: move transaction commit from repository to service layer#116
Besthope-Official merged 1 commit into
mainfrom
fix/audit-log-commit

Conversation

@Besthope-Official
Copy link
Copy Markdown
Contributor

Related Issue

Closes #112

Summary of Changes

Removed transaction commit from repository layer and moved it to service layer:

  • AuditRepository.create_audit_log(): Removed await self.session.commit() at src/audit/service.py:39
  • AuditService.log(): Added await self.repository.session.commit() and await self.repository.session.rollback() for transaction control
  • Updated tests/audit/test_service.py to remove commit assertion from repository test

Repository layer no longer controls transaction boundaries. Service layer manages commit/rollback, enabling future atomic operations across multiple repositories.

Breaking Changes

N/A

Checklist

  • Issue discussion completed before opening PR
  • Scope is small and focused (single feature/fix)
  • All functions have full type annotations
  • Async/await used for all I/O operations
  • Tests added for new behaviors

@Besthope-Official Besthope-Official merged commit 42ab57a into main Feb 3, 2026
3 checks passed
@Besthope-Official Besthope-Official added the Backend-enhanced backend enhancement label Feb 3, 2026
@Besthope-Official Besthope-Official deleted the fix/audit-log-commit branch February 3, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend-enhanced backend enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: remove transaction commits from repository layer

1 participant