From 50870d3e6129021551271f0525ec01b2d5610531 Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 19 Sep 2024 13:05:26 -0400 Subject: [PATCH] fix(ui): sort by favourited --- persistence/album_repository.go | 2 ++ persistence/artist_repository.go | 6 ++++-- persistence/mediafile_repository.go | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/persistence/album_repository.go b/persistence/album_repository.go index 37469d27d..0047dcacb 100644 --- a/persistence/album_repository.go +++ b/persistence/album_repository.go @@ -77,6 +77,7 @@ func NewAlbumRepository(ctx context.Context, db dbx.Builder) model.AlbumReposito "max_year": "coalesce(nullif(original_date,''), cast(max_year as text)), release_date, name, COALESCE(NULLIF(sort_album_name,''),order_album_name) asc", "random": r.seededRandomSort(), "recently_added": recentlyAddedSort(), + "starred_at": "starred, starred_at", } } else { r.sortMappings = map[string]string{ @@ -86,6 +87,7 @@ func NewAlbumRepository(ctx context.Context, db dbx.Builder) model.AlbumReposito "max_year": "coalesce(nullif(original_date,''), cast(max_year as text)), release_date, name, order_album_name asc", "random": r.seededRandomSort(), "recently_added": recentlyAddedSort(), + "starred_at": "starred, starred_at", } } diff --git a/persistence/artist_repository.go b/persistence/artist_repository.go index 8f41a4f7a..e55dd2952 100644 --- a/persistence/artist_repository.go +++ b/persistence/artist_repository.go @@ -68,11 +68,13 @@ func NewArtistRepository(ctx context.Context, db dbx.Builder) model.ArtistReposi }) if conf.Server.PreferSortTags { r.sortMappings = map[string]string{ - "name": "COALESCE(NULLIF(sort_artist_name,''),order_artist_name)", + "name": "COALESCE(NULLIF(sort_artist_name,''),order_artist_name)", + "starred_at": "starred, starred_at", } } else { r.sortMappings = map[string]string{ - "name": "order_artist_name", + "name": "order_artist_name", + "starred_at": "starred, starred_at", } } return r diff --git a/persistence/mediafile_repository.go b/persistence/mediafile_repository.go index 8e21b3625..a63094cec 100644 --- a/persistence/mediafile_repository.go +++ b/persistence/mediafile_repository.go @@ -39,6 +39,7 @@ func NewMediaFileRepository(ctx context.Context, db dbx.Builder) *mediaFileRepos "random": r.seededRandomSort(), "created_at": "media_file.created_at", "track_number": "album, release_date, disc_number, track_number", + "starred_at": "starred, starred_at", } } else { r.sortMappings = map[string]string{ @@ -48,6 +49,7 @@ func NewMediaFileRepository(ctx context.Context, db dbx.Builder) *mediaFileRepos "random": r.seededRandomSort(), "created_at": "media_file.created_at", "track_number": "album, release_date, disc_number, track_number", + "starred_at": "starred, starred_at", } } return r