Skip to content

refactor: repository SRP split + data/mapper extraction - #4

Merged
jdluu merged 1 commit into
mainfrom
refactor/repo-split
Aug 26, 2026
Merged

refactor: repository SRP split + data/mapper extraction#4
jdluu merged 1 commit into
mainfrom
refactor/repo-split

Conversation

@jdluu

@jdluu jdluu commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 3 of the refactor plan.

  • New data/mapper/ package: all API/entity-to-domain mapping extracted verbatim from model extension functions into WorkoutMapper / RoutineMapper / ExerciseMapper - models are now plain data classes
  • WorkoutRepositoryImpl split by responsibility: queries vs mutations (WorkoutQueryRepository, WorkoutMutationRepository), old interface preserved as a delegating facade so zero ViewModel/use-case changes
  • StatsRepositoryImpl given the same treatment (it was still 539 lines post-Phase-2)
  • Hilt bindings updated in RepositoryModule

Test Plan

  • All pre-existing tests pass unchanged; 19 new mapper tests added (268 -> 287)
  • ./gradlew testDebugUnitTest lintDebug assembleDebug exit 0, 0 lint errors
  • CI green on this PR

- Move API/entity-to-domain mapping from inline extension functions in
  model files into dedicated pure mapper objects (data/mapper/):
  WorkoutMapper, RoutineMapper, ExerciseMapper
- Split WorkoutRepositoryImpl (525 lines) into WorkoutQueryRepository
  and WorkoutMutationRepository behind an unchanged WorkoutRepository
  facade; ViewModels and use cases untouched
- Same read/write split for StatsRepositoryImpl -> StatsQueryRepository
  + StatsMutationRepository
- Add 19 mapper unit tests; all 268 pre-existing tests pass unchanged
@jdluu
jdluu merged commit 3feadb0 into main Aug 26, 2026
3 checks passed
@jdluu
jdluu deleted the refactor/repo-split branch August 26, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant