refactor: remove annotation handling from engine
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ import "time"
|
||||
type Album struct {
|
||||
ID string `json:"id" orm:"column(id)"`
|
||||
Name string `json:"name"`
|
||||
ArtistID string `json:"artistId"`
|
||||
ArtistID string `json:"artistId" orm:"pk;column(artist_id)"`
|
||||
CoverArtPath string `json:"-"`
|
||||
CoverArtId string `json:"-"`
|
||||
Artist string `json:"artist"`
|
||||
@@ -37,7 +37,7 @@ type AlbumRepository interface {
|
||||
GetAll(...QueryOptions) (Albums, error)
|
||||
GetMap(ids []string) (map[string]Album, error)
|
||||
GetRandom(...QueryOptions) (Albums, error)
|
||||
GetStarred(userId string, options ...QueryOptions) (Albums, error)
|
||||
GetStarred(options ...QueryOptions) (Albums, error)
|
||||
Search(q string, offset int, size int) (Albums, error)
|
||||
Refresh(ids ...string) error
|
||||
PurgeEmpty() error
|
||||
|
||||
+13
-16
@@ -9,25 +9,22 @@ const (
|
||||
)
|
||||
|
||||
type Annotation struct {
|
||||
AnnotationID string
|
||||
UserID string
|
||||
ItemID string
|
||||
ItemType string
|
||||
PlayCount int
|
||||
PlayDate time.Time
|
||||
Rating int
|
||||
Starred bool
|
||||
StarredAt time.Time
|
||||
AnnID string `json:"annID" orm:"pk;column(ann_id)"`
|
||||
UserID string `json:"userID" orm:"pk;column(user_id)"`
|
||||
ItemID string `json:"itemID" orm:"pk;column(item_id)"`
|
||||
ItemType string `json:"itemType"`
|
||||
PlayCount int `json:"playCount"`
|
||||
PlayDate time.Time `json:"playDate"`
|
||||
Rating int `json:"rating"`
|
||||
Starred bool `json:"starred"`
|
||||
StarredAt time.Time `json:"starredAt"`
|
||||
}
|
||||
|
||||
type AnnotationMap map[string]Annotation
|
||||
|
||||
type AnnotationRepository interface {
|
||||
Get(userID, itemType string, itemID string) (*Annotation, error)
|
||||
GetAll(userID, itemType string, options ...QueryOptions) ([]Annotation, error)
|
||||
GetMap(userID, itemType string, itemID []string) (AnnotationMap, error)
|
||||
Delete(userID, itemType string, itemID ...string) error
|
||||
IncPlayCount(userID, itemType string, itemID string, ts time.Time) error
|
||||
SetStar(starred bool, userID, itemType string, ids ...string) error
|
||||
SetRating(rating int, userID, itemType string, itemID string) error
|
||||
Delete(itemType string, itemID ...string) error
|
||||
IncPlayCount(itemType, itemID string, ts time.Time) error
|
||||
SetStar(starred bool, itemType string, ids ...string) error
|
||||
SetRating(rating int, itemType, itemID string) error
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ type ArtistRepository interface {
|
||||
Exists(id string) (bool, error)
|
||||
Put(m *Artist) error
|
||||
Get(id string) (*Artist, error)
|
||||
GetStarred(userId string, options ...QueryOptions) (Artists, error)
|
||||
GetStarred(options ...QueryOptions) (Artists, error)
|
||||
Search(q string, offset int, size int) (Artists, error)
|
||||
Refresh(ids ...string) error
|
||||
GetIndex() (ArtistIndexes, error)
|
||||
|
||||
+3
-4
@@ -11,9 +11,9 @@ type MediaFile struct {
|
||||
Title string `json:"title"`
|
||||
Album string `json:"album"`
|
||||
Artist string `json:"artist"`
|
||||
ArtistID string `json:"artistId"`
|
||||
ArtistID string `json:"artistId" orm:"pk;column(artist_id)"`
|
||||
AlbumArtist string `json:"albumArtist"`
|
||||
AlbumID string `json:"albumId"`
|
||||
AlbumID string `json:"albumId" orm:"pk;column(album_id)"`
|
||||
HasCoverArt bool `json:"hasCoverArt"`
|
||||
TrackNumber int `json:"trackNumber"`
|
||||
DiscNumber int `json:"discNumber"`
|
||||
@@ -48,8 +48,7 @@ type MediaFileRepository interface {
|
||||
Get(id string) (*MediaFile, error)
|
||||
FindByAlbum(albumId string) (MediaFiles, error)
|
||||
FindByPath(path string) (MediaFiles, error)
|
||||
// TODO Remove userId
|
||||
GetStarred(userId string, options ...QueryOptions) (MediaFiles, error)
|
||||
GetStarred(options ...QueryOptions) (MediaFiles, error)
|
||||
GetRandom(options ...QueryOptions) (MediaFiles, error)
|
||||
Search(q string, offset int, size int) (MediaFiles, error)
|
||||
Delete(id string) error
|
||||
|
||||
Reference in New Issue
Block a user