fix: address code review findings

This commit is contained in:
2026-07-19 19:52:27 +03:00
parent a7803615cd
commit 0bee9b9b27
6 changed files with 138 additions and 31 deletions

View File

@@ -120,13 +120,16 @@ func IsTypeIncluded(releaseType string) bool {
// MBID) must NOT be stored here, because artist_settings is keyed by the
// Navidrome ID and the foreign key / join would otherwise never match.
func (rg *ReleaseGroup) ToExternalRelease(artistID string) *database.ExternalRelease {
// Only the primary type is persisted; secondary types are used transiently
// for filtering above and are not stored in the external_releases schema.
// The primary type and the secondary types are both persisted so that the
// cache-hit path in SyncArtistDiscography can re-apply the same
// IgnoreSingles / IgnoreCompilations rules (which consider secondary types)
// as the cache-miss path, keeping results stable across cache refreshes.
return &database.ExternalRelease{
RGID: rg.ID,
ArtistID: artistID,
Title: rg.Title,
Type: rg.Type,
ReleaseDate: rg.ReleaseDate,
RGID: rg.ID,
ArtistID: artistID,
Title: rg.Title,
Type: rg.Type,
ReleaseDate: rg.ReleaseDate,
SecondaryTypes: rg.SecondaryTypes,
}
}