feat: search/merge items by id

This commit is contained in:
Gabe Farrell 2025-06-21 14:25:31 -04:00
parent 5537b6fb89
commit 1425f7f416
9 changed files with 752 additions and 46 deletions

View file

@ -2,6 +2,7 @@ package psql
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
@ -34,6 +35,10 @@ func (d *Psql) GetTrack(ctx context.Context, opts db.GetTrackOpts) (*models.Trac
Image: t.Image,
Duration: t.Duration,
}
err = json.Unmarshal(t.Artists, &track.Artists)
if err != nil {
return nil, fmt.Errorf("GetTrack: json.Unmarshal: %w", err)
}
} else if opts.MusicBrainzID != uuid.Nil {
l.Debug().Msgf("Fetching track from DB with MusicBrainz ID %s", opts.MusicBrainzID)
t, err := d.q.GetTrackByMbzID(ctx, &opts.MusicBrainzID)