fix: address code review findings
Remove dead code: duplicate ExternalRelease/Artist/ParsedArtist structs in model.go, ParseArtist/mbArtist/mbArtistData in client.go, ArtistTypeFilter and related filtering functions in api.go, SyncArtistDiscographyWithFilter in sync.go, and CacheStats/IsArtistCacheValid in cache.go. Fix bugs: SaveExternalRelease now stores NULL instead of empty string for zero CachedAt; sync upserts are now transactional with stale release cleanup; getCachedReleases returns int instead of *CacheStats; doGet uses url.Values for proper query encoding of MBID. Fix tests: removed duplicate TestRun_GracefulShutdown, removed dead code (_ = dbPath) from TestNewApp, fixed assertions in httptest handler goroutine to avoid data race, increased rate limiter timing tolerance, removed Client.Close() calls (no-op removed), fixed sync test cache expiry to use UPDATE instead of 0 TTL races. Fix formatting: cancel()}() formatting in main.go, error format string in sync.go.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package musicbrainz
|
||||
|
||||
import "time"
|
||||
|
||||
// ReleaseGroup represents a MusicBrainz Release Group entity.
|
||||
// This is the primary data model for the provider - we work with
|
||||
// Release Groups to minimize duplicates from different releases.
|
||||
@@ -15,32 +13,9 @@ type ReleaseGroup struct {
|
||||
ReleaseDate string
|
||||
}
|
||||
|
||||
// Artist represents a MusicBrainz artist entity.
|
||||
type Artist struct {
|
||||
ID string
|
||||
Name string
|
||||
}
|
||||
|
||||
// ExternalRelease is the normalized form stored in the database,
|
||||
// matching the external_releases table schema.
|
||||
type ExternalRelease struct {
|
||||
RGID string
|
||||
ArtistID string
|
||||
Title string
|
||||
Type string
|
||||
ReleaseDate string
|
||||
CachedAt time.Time
|
||||
}
|
||||
|
||||
// ParsedReleaseGroups holds the result of parsing a MusicBrainz
|
||||
// release-group list XML response.
|
||||
type ParsedReleaseGroups struct {
|
||||
ReleaseGroups []ReleaseGroup
|
||||
Count int
|
||||
}
|
||||
|
||||
// ParsedArtist holds the result of parsing a MusicBrainz artist lookup.
|
||||
type ParsedArtist struct {
|
||||
ID string
|
||||
Name string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user