fix(server): forward-fix CI — gofmt convert/types + rename unused r in enricher_test
This commit is contained in:
@@ -105,14 +105,14 @@ func artistRefFromCovered(a dbq.Artist, albumCount int, coverAlbumID pgtype.UUID
|
|||||||
// durationSec may be 0 when the caller does not compute them.
|
// durationSec may be 0 when the caller does not compute them.
|
||||||
func albumRefFrom(a dbq.Album, artistName string, trackCount, durationSec int) AlbumRef {
|
func albumRefFrom(a dbq.Album, artistName string, trackCount, durationSec int) AlbumRef {
|
||||||
return AlbumRef{
|
return AlbumRef{
|
||||||
ID: uuidToString(a.ID),
|
ID: uuidToString(a.ID),
|
||||||
Title: a.Title,
|
Title: a.Title,
|
||||||
SortTitle: a.SortTitle,
|
SortTitle: a.SortTitle,
|
||||||
ArtistID: uuidToString(a.ArtistID),
|
ArtistID: uuidToString(a.ArtistID),
|
||||||
ArtistName: artistName,
|
ArtistName: artistName,
|
||||||
Year: yearFromDate(a.ReleaseDate),
|
Year: yearFromDate(a.ReleaseDate),
|
||||||
TrackCount: trackCount,
|
TrackCount: trackCount,
|
||||||
DurationSec: durationSec,
|
DurationSec: durationSec,
|
||||||
CoverURL: coverURL(a.ID),
|
CoverURL: coverURL(a.ID),
|
||||||
CoverArtSource: a.CoverArtSource,
|
CoverArtSource: a.CoverArtSource,
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -57,16 +57,16 @@ type ArtistRef struct {
|
|||||||
// divider can group rows by sort order ("The Wall" → "W"). CoverURL points
|
// divider can group rows by sort order ("The Wall" → "W"). CoverURL points
|
||||||
// to /api/albums/{id}/cover.
|
// to /api/albums/{id}/cover.
|
||||||
type AlbumRef struct {
|
type AlbumRef struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
SortTitle string `json:"sort_title"`
|
SortTitle string `json:"sort_title"`
|
||||||
ArtistID string `json:"artist_id"`
|
ArtistID string `json:"artist_id"`
|
||||||
ArtistName string `json:"artist_name"`
|
ArtistName string `json:"artist_name"`
|
||||||
Year int `json:"year,omitempty"`
|
Year int `json:"year,omitempty"`
|
||||||
TrackCount int `json:"track_count"`
|
TrackCount int `json:"track_count"`
|
||||||
DurationSec int `json:"duration_sec"`
|
DurationSec int `json:"duration_sec"`
|
||||||
CoverURL string `json:"cover_url"`
|
CoverURL string `json:"cover_url"`
|
||||||
CoverArtSource *string `json:"cover_art_source"`
|
CoverArtSource *string `json:"cover_art_source"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TrackRef is the lightweight track shape used in album details and search.
|
// TrackRef is the lightweight track shape used in album details and search.
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ func TestEnrichAlbum_MBCAAFetchSuccess(t *testing.T) {
|
|||||||
pool := newPool(t)
|
pool := newPool(t)
|
||||||
id, dir := seedAlbumWithTrack(t, pool, "Mbcaa", "Artist", "test-mbid-123")
|
id, dir := seedAlbumWithTrack(t, pool, "Mbcaa", "Artist", "test-mbid-123")
|
||||||
|
|
||||||
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.Header().Set("Content-Type", "image/jpeg")
|
w.Header().Set("Content-Type", "image/jpeg")
|
||||||
_, _ = w.Write([]byte("MBCAA_BYTES"))
|
_, _ = w.Write([]byte("MBCAA_BYTES"))
|
||||||
}))
|
}))
|
||||||
@@ -157,7 +157,7 @@ func TestEnrichAlbum_MBCAA404_RecordsNone(t *testing.T) {
|
|||||||
pool := newPool(t)
|
pool := newPool(t)
|
||||||
id, _ := seedAlbumWithTrack(t, pool, "Missing", "Artist", "missing-mbid")
|
id, _ := seedAlbumWithTrack(t, pool, "Missing", "Artist", "missing-mbid")
|
||||||
|
|
||||||
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
http.Error(w, "not found", http.StatusNotFound)
|
http.Error(w, "not found", http.StatusNotFound)
|
||||||
}))
|
}))
|
||||||
defer upstream.Close()
|
defer upstream.Close()
|
||||||
@@ -242,7 +242,7 @@ func TestRetryAlbum_DeletesMbcaaFileAndRefetches(t *testing.T) {
|
|||||||
id, dir := seedAlbumWithTrack(t, pool, "Retry", "Artist", "retry-mbid")
|
id, dir := seedAlbumWithTrack(t, pool, "Retry", "Artist", "retry-mbid")
|
||||||
|
|
||||||
hits := 0
|
hits := 0
|
||||||
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
hits++
|
hits++
|
||||||
_, _ = w.Write([]byte("data"))
|
_, _ = w.Write([]byte("data"))
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user