Split the monolithic DatabaseService (1,492 lines) into focused repository
modules using the repository pattern for better maintainability and
separation of concerns.
Changes:
- Create new repositories/ directory with 5 focused repositories:
- TransactionRepository: transaction data operations (264 lines)
- AccountRepository: account data operations (128 lines)
- BalanceRepository: balance data operations (107 lines)
- MigrationRepository: all database migrations (629 lines)
- SyncRepository: sync operation tracking (132 lines)
- BaseRepository: shared database connection logic (28 lines)
- Refactor DatabaseService into a clean facade (287 lines):
- Delegates data access to repositories
- Maintains public API (no breaking changes)
- Keeps data processors in service layer
- Preserves require_sqlite decorator
- Update tests to mock repository methods instead of private methods
- Fix test references to internal methods (_persist_*, _get_*)
Benefits:
- Clear separation of concerns (one repository per domain)
- Easier maintenance (changes isolated to specific repositories)
- Better testability (repositories can be mocked individually)
- Improved code organization (from 1 file to 7 focused files)
All 114 tests passing.
- Merge leggen/database/sqlite.py functionality directly into DatabaseService
- Extract transaction processing logic to separate TransactionProcessor class
- Remove leggen/utils/database.py and leggen/database/ directory entirely
- Update all tests to use new consolidated structure
- Reduce codebase by ~300 lines while maintaining full functionality
- Improve separation of concerns: data processing vs persistence vs CLI
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Merge leggend API components into leggen (api/, services/, background/)
- Replace leggend command with 'leggen server' subcommand
- Consolidate configuration systems into leggen.utils.config
- Update environment variables: LEGGEND_API_URL -> LEGGEN_API_URL
- Rename LeggendAPIClient -> LeggenAPIClient
- Update all documentation, Docker configs, and compose files
- Fix all import statements and test references
- Remove duplicate utility files and clean up package structure
All tests passing (101/101), linting clean, server functionality preserved.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>