refactor: annotations

This commit is contained in:
Deluan
2020-01-31 21:09:23 -05:00
committed by Deluan Quintão
parent de1fea64bc
commit 88e01d05f6
16 changed files with 184 additions and 197 deletions
+5 -5
View File
@@ -26,9 +26,9 @@ func (r ratings) SetRating(ctx context.Context, id string, rating int) error {
return err
}
if exist {
return r.ds.Annotation(ctx).SetRating(rating, model.AlbumItemType, id)
return r.ds.Album(ctx).SetRating(rating, id)
}
return r.ds.Annotation(ctx).SetRating(rating, model.MediaItemType, id)
return r.ds.MediaFile(ctx).SetRating(rating, id)
}
func (r ratings) SetStar(ctx context.Context, star bool, ids ...string) error {
@@ -44,7 +44,7 @@ func (r ratings) SetStar(ctx context.Context, star bool, ids ...string) error {
return err
}
if exist {
err = tx.Annotation(ctx).SetStar(star, model.AlbumItemType, ids...)
err = tx.Album(ctx).SetStar(star, ids...)
if err != nil {
return err
}
@@ -55,13 +55,13 @@ func (r ratings) SetStar(ctx context.Context, star bool, ids ...string) error {
return err
}
if exist {
err = tx.Annotation(ctx).SetStar(star, model.ArtistItemType, ids...)
err = tx.Artist(ctx).SetStar(star, ids...)
if err != nil {
return err
}
continue
}
err = tx.Annotation(ctx).SetStar(star, model.MediaItemType, ids...)
err = tx.MediaFile(ctx).SetStar(star, ids...)
if err != nil {
return err
}