1.4 KiB
1.4 KiB
id, title, status, assignee, created_date, labels, dependencies, references, priority
| id | title | status | assignee | created_date | labels | dependencies | references | priority | |
|---|---|---|---|---|---|---|---|---|---|
| ML-63 | Break bidirectional dependency between Records and Artists | Done | 2026-04-20 08:54 |
|
medium |
Description
GitHub: created 2026-03-12 · updated 2026-03-12 · closed 2026-03-12
Problem
Records and Artists have a bidirectional dependency: Records → Artists (async Oban calls on create/delete) and Artists → Records (get_collected_artist_ids/0 joins Records.Record directly). The direct schema query from Artists → Records is a hard compile-time dependency on another context's schema.
Proposed solution
Move get_collected_artist_ids/0 into Collection (which already owns the purchased_at IS NOT NULL scoping concern). Then Artists.get_similar_artists/1 calls Collection.collected_artist_ids() instead. Accept ArtistRecord as a shared read-only schema used by both domains.
Steps
- Add
collected_artist_ids/0toMusicLibrary.Collection - Update
Artists.get_similar_artists/1to callCollection.collected_artist_ids() - Remove
Records.Recordalias fromArtists - Remove the private
get_collected_artist_ids/0fromArtists - Update tests
Files involved
lib/music_library/artists.exlib/music_library/collection.ex- Tests for
ArtistsandCollection