88372c9301
- Add SaveAlbumTracks to TrackRepository for batch track caching - Extend album loadRelations to join album_artists with artist data - Cache album tracks in GetAlbumTracks after provider fetch - Ensure artists cached when fetching single album
33 lines
1.4 KiB
Go
33 lines
1.4 KiB
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/metadata-agregator/internal/domain"
|
|
)
|
|
|
|
type ArtistRepository interface {
|
|
GetByID(ctx context.Context, id string) (*domain.Artist, error)
|
|
GetByExternalID(ctx context.Context, source, sourceID string) (*domain.Artist, error)
|
|
Search(ctx context.Context, query string, limit, offset int) (*domain.SearchResult[domain.Artist], error)
|
|
Save(ctx context.Context, artist *domain.Artist) error
|
|
}
|
|
|
|
type AlbumRepository interface {
|
|
GetByID(ctx context.Context, id string) (*domain.Album, error)
|
|
GetByExternalID(ctx context.Context, source, sourceID string) (*domain.Album, error)
|
|
GetByArtistID(ctx context.Context, artistID string, limit, offset int) (*domain.SearchResult[domain.Album], error)
|
|
GetAllByArtistID(ctx context.Context, artistID string) ([]domain.Album, error)
|
|
Save(ctx context.Context, album *domain.Album) error
|
|
SaveAll(ctx context.Context, albums []domain.Album) error
|
|
}
|
|
|
|
type TrackRepository interface {
|
|
GetByID(ctx context.Context, id string) (*domain.Track, error)
|
|
GetByExternalID(ctx context.Context, source, sourceID string) (*domain.Track, error)
|
|
GetByISRC(ctx context.Context, isrc string) (*domain.Track, error)
|
|
GetByAlbumID(ctx context.Context, albumID string) ([]domain.Track, error)
|
|
Save(ctx context.Context, track *domain.Track) error
|
|
SaveAlbumTracks(ctx context.Context, albumID string, tracks []domain.Track) error
|
|
}
|