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