2020-01-14 22:22:34 -05:00
|
|
|
package model
|
2016-02-26 01:32:31 -05:00
|
|
|
|
2016-03-04 09:09:16 -05:00
|
|
|
import "time"
|
|
|
|
|
|
2016-02-26 01:32:31 -05:00
|
|
|
type Album struct {
|
2020-01-28 08:22:17 -05:00
|
|
|
ID string `json:"id" orm:"column(id)"`
|
|
|
|
|
Name string `json:"name"`
|
2020-01-30 22:07:02 -05:00
|
|
|
ArtistID string `json:"artistId" orm:"pk;column(artist_id)"`
|
2020-01-31 09:53:19 -05:00
|
|
|
CoverArtPath string `json:"coverArtPath"`
|
|
|
|
|
CoverArtId string `json:"coverArtId"`
|
2020-01-28 08:22:17 -05:00
|
|
|
Artist string `json:"artist"`
|
|
|
|
|
AlbumArtist string `json:"albumArtist"`
|
|
|
|
|
Year int `json:"year"`
|
|
|
|
|
Compilation bool `json:"compilation"`
|
|
|
|
|
SongCount int `json:"songCount"`
|
2020-02-20 17:00:56 -05:00
|
|
|
Duration float32 `json:"duration"`
|
2020-01-28 08:22:17 -05:00
|
|
|
Genre string `json:"genre"`
|
|
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
|
|
|
|
|
|
|
|
// Annotations
|
2020-01-31 09:53:19 -05:00
|
|
|
PlayCount int `json:"-" orm:"-"`
|
|
|
|
|
PlayDate time.Time `json:"-" orm:"-"`
|
|
|
|
|
Rating int `json:"-" orm:"-"`
|
|
|
|
|
Starred bool `json:"-" orm:"-"`
|
|
|
|
|
StarredAt time.Time `json:"-" orm:"-"`
|
2016-03-02 09:33:49 -05:00
|
|
|
}
|
|
|
|
|
|
2016-03-03 21:01:55 -05:00
|
|
|
type Albums []Album
|
|
|
|
|
|
2016-03-02 09:33:49 -05:00
|
|
|
type AlbumRepository interface {
|
2020-01-28 08:22:17 -05:00
|
|
|
CountAll(...QueryOptions) (int64, error)
|
2020-01-15 08:21:32 -05:00
|
|
|
Exists(id string) (bool, error)
|
2016-03-02 09:33:49 -05:00
|
|
|
Put(m *Album) error
|
|
|
|
|
Get(id string) (*Album, error)
|
2016-03-20 13:14:04 -04:00
|
|
|
FindByArtist(artistId string) (Albums, error)
|
2020-01-11 21:25:37 -05:00
|
|
|
GetAll(...QueryOptions) (Albums, error)
|
2020-01-21 08:49:43 -05:00
|
|
|
GetRandom(...QueryOptions) (Albums, error)
|
2020-01-30 22:07:02 -05:00
|
|
|
GetStarred(options ...QueryOptions) (Albums, error)
|
2020-01-13 15:41:14 -05:00
|
|
|
Search(q string, offset int, size int) (Albums, error)
|
2020-01-16 16:53:48 -05:00
|
|
|
Refresh(ids ...string) error
|
2020-01-17 23:28:11 -05:00
|
|
|
PurgeEmpty() error
|
2020-01-31 21:09:23 -05:00
|
|
|
AnnotatedRepository
|
2016-03-02 13:18:39 -05:00
|
|
|
}
|