1.8 KiB
1.8 KiB
id, title, status, assignee, created_date, labels, dependencies, references, priority
| id | title | status | assignee | created_date | labels | dependencies | references | priority | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ML-153 | Move MusicBrainz data transformations out of Record schema | To Do | 2026-04-30 10:48 |
|
|
medium |
Description
The Record schema (lib/music_library/records/record.ex) contains MusicBrainz-specific data transformation functions that belong in the MusicBrainz API layer, not in the database schema:
parse_artists/1— extracts artist credits from MusicBrainz API responseparse_subtype/2/parse_secondary_types/1— maps MusicBrainz type strings toRecordenum valuesattrs_from_release_group/1— builds a changeset attrs map from a MusicBrainz release group
These functions are called by add_musicbrainz_data/2 (changeset pipeline) and during MusicBrainz import flows.
Move the parsing functions to appropriate MusicBrainz modules (e.g., MusicBrainz.ReleaseGroup already has related helpers) and keep only struct introspection/presentation functions on Record (artist_names/1, releases/1, released?/1, format_release_date/1, etc.).
Update callers in:
Record.changeset/2andadd_musicbrainz_data/2Recordscontext (import functions)- Any tests that reference the moved functions directly
Acceptance Criteria
- #1
parse_artists/1,parse_subtype/2,parse_secondary_types/1, andattrs_from_release_group/1are moved toMusicBrainzmodules - #2
Recordschema retains only struct introspection and presentation helpers - #3 All callers are updated to use the new locations
- #4 Full test suite passes
- #5
@moduledocon moved functions explains their purpose