mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +03:00
Fix GetStarred for all item types
This commit is contained in:
parent
c8fb84cd1e
commit
1f58bf47d6
3 changed files with 12 additions and 3 deletions
|
@ -188,7 +188,10 @@ func (r *albumRepository) PurgeEmpty() error {
|
|||
func (r *albumRepository) GetStarred(userId string, options ...model.QueryOptions) (model.Albums, error) {
|
||||
var starred []album
|
||||
sq := r.newRawQuery(options...).Join("annotation").Where("annotation.item_id = " + r.tableName + ".id")
|
||||
sq = sq.Where(squirrel.Eq{"annotation.user_id": userId})
|
||||
sq = sq.Where(squirrel.And{
|
||||
squirrel.Eq{"annotation.user_id": userId},
|
||||
squirrel.Eq{"annotation.starred": true},
|
||||
})
|
||||
sql, args, err := sq.ToSql()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -157,7 +157,10 @@ where f.artist_id in ('%s') group by f.artist_id order by f.id`, strings.Join(id
|
|||
func (r *artistRepository) GetStarred(userId string, options ...model.QueryOptions) (model.Artists, error) {
|
||||
var starred []artist
|
||||
sq := r.newRawQuery(options...).Join("annotation").Where("annotation.item_id = " + r.tableName + ".id")
|
||||
sq = sq.Where(squirrel.Eq{"annotation.user_id": userId})
|
||||
sq = sq.Where(squirrel.And{
|
||||
squirrel.Eq{"annotation.user_id": userId},
|
||||
squirrel.Eq{"annotation.starred": true},
|
||||
})
|
||||
sql, args, err := sq.ToSql()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -144,7 +144,10 @@ func (r *mediaFileRepository) GetRandom(options ...model.QueryOptions) (model.Me
|
|||
func (r *mediaFileRepository) GetStarred(userId string, options ...model.QueryOptions) (model.MediaFiles, error) {
|
||||
var starred []mediaFile
|
||||
sq := r.newRawQuery(options...).Join("annotation").Where("annotation.item_id = " + r.tableName + ".id")
|
||||
sq = sq.Where(squirrel.Eq{"annotation.user_id": userId})
|
||||
sq = sq.Where(squirrel.And{
|
||||
squirrel.Eq{"annotation.user_id": userId},
|
||||
squirrel.Eq{"annotation.starred": true},
|
||||
})
|
||||
sql, args, err := sq.ToSql()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue