2020-01-14 18:22:34 -09:00
|
|
|
package model
|
2016-02-25 21:32:31 -09:00
|
|
|
|
2020-10-30 12:08:43 -08:00
|
|
|
import "time"
|
|
|
|
|
|
2016-02-25 21:32:31 -09:00
|
|
|
type Artist struct {
|
2020-05-22 11:23:42 -08:00
|
|
|
Annotations
|
|
|
|
|
|
2020-10-30 12:08:43 -08:00
|
|
|
ID string `json:"id" orm:"column(id)"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
AlbumCount int `json:"albumCount"`
|
|
|
|
|
SongCount int `json:"songCount"`
|
|
|
|
|
FullText string `json:"fullText"`
|
2021-05-31 08:20:21 -08:00
|
|
|
SortArtistName string `json:"sortArtistName,omitempty"`
|
2020-10-30 12:08:43 -08:00
|
|
|
OrderArtistName string `json:"orderArtistName"`
|
|
|
|
|
Size int64 `json:"size"`
|
2021-05-31 08:20:21 -08:00
|
|
|
MbzArtistID string `json:"mbzArtistId,omitempty" orm:"column(mbz_artist_id)"`
|
|
|
|
|
Biography string `json:"biography,omitempty"`
|
|
|
|
|
SmallImageUrl string `json:"smallImageUrl,omitempty"`
|
|
|
|
|
MediumImageUrl string `json:"mediumImageUrl,omitempty"`
|
|
|
|
|
LargeImageUrl string `json:"largeImageUrl,omitempty"`
|
|
|
|
|
ExternalUrl string `json:"externalUrl,omitempty" orm:"column(external_url)"`
|
2020-10-30 12:08:43 -08:00
|
|
|
SimilarArtists Artists `json:"-" orm:"-"`
|
|
|
|
|
ExternalInfoUpdatedAt time.Time `json:"externalInfoUpdatedAt"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a Artist) ArtistImageUrl() string {
|
|
|
|
|
if a.MediumImageUrl != "" {
|
|
|
|
|
return a.MediumImageUrl
|
|
|
|
|
}
|
|
|
|
|
if a.LargeImageUrl != "" {
|
|
|
|
|
return a.LargeImageUrl
|
|
|
|
|
}
|
|
|
|
|
return a.SmallImageUrl
|
2016-03-02 05:33:49 -09:00
|
|
|
}
|
2020-01-28 04:22:17 -09:00
|
|
|
|
2020-01-17 16:46:19 -09:00
|
|
|
type Artists []Artist
|
|
|
|
|
|
|
|
|
|
type ArtistIndex struct {
|
|
|
|
|
ID string
|
|
|
|
|
Artists Artists
|
|
|
|
|
}
|
|
|
|
|
type ArtistIndexes []ArtistIndex
|
2016-03-02 05:33:49 -09:00
|
|
|
|
|
|
|
|
type ArtistRepository interface {
|
2020-01-28 04:22:17 -09:00
|
|
|
CountAll(options ...QueryOptions) (int64, error)
|
2020-01-15 04:21:32 -09:00
|
|
|
Exists(id string) (bool, error)
|
2016-03-02 05:33:49 -09:00
|
|
|
Put(m *Artist) error
|
|
|
|
|
Get(id string) (*Artist, error)
|
2020-10-30 12:08:43 -08:00
|
|
|
GetAll(options ...QueryOptions) (Artists, error)
|
2020-01-30 18:07:02 -09:00
|
|
|
GetStarred(options ...QueryOptions) (Artists, error)
|
2020-01-13 12:02:49 -09:00
|
|
|
Search(q string, offset int, size int) (Artists, error)
|
2020-01-16 12:53:48 -09:00
|
|
|
Refresh(ids ...string) error
|
2020-01-17 16:46:19 -09:00
|
|
|
GetIndex() (ArtistIndexes, error)
|
2020-01-31 17:09:23 -09:00
|
|
|
AnnotatedRepository
|
2016-03-02 05:33:49 -09:00
|
|
|
}
|
2020-05-22 11:23:42 -08:00
|
|
|
|
|
|
|
|
func (a Artist) GetAnnotations() Annotations {
|
|
|
|
|
return a.Annotations
|
|
|
|
|
}
|