refactor: split SqliteMovieRepository fat repo into per-port structs #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
SqliteMovieRepositoryimplements four unrelated port traits —MovieRepository,ReviewRepository,DiaryRepository,StatsRepository— while every other entity (users, watchlist, import_session, etc.) gets its own dedicated struct. The inconsistency makes the codebase harder to navigate: the name gives no hint it owns review/diary/stats logic, andwire()has to clone the sameArcfour times with different coercions.Proposed fix
Split into four structs, each implementing exactly one port trait and holding a pool clone:
SqliteMovieRepository→MovieRepositorySqliteReviewRepository→ReviewRepositorySqliteDiaryRepository→DiaryRepositorySqliteStatsRepository→StatsRepositoryPrivate helper methods on the fat struct that are shared across these domains move into whichever repo actually owns them.
wire()becomes uniform — every port maps to exactly one dedicated struct.Impact
crates/adapters/sqlite/src/lib.rs(primary)crates/adapters/postgres/src/(same pattern likely applies)wire()in both sqlite and postgres adapters