diff --git a/persistence/mediafile_repository.go b/persistence/mediafile_repository.go index 39fa4a34f..952e989bc 100644 --- a/persistence/mediafile_repository.go +++ b/persistence/mediafile_repository.go @@ -33,23 +33,21 @@ func NewMediaFileRepository(ctx context.Context, db dbx.Builder) *mediaFileRepos }) if conf.Server.PreferSortTags { r.sortMappings = map[string]string{ - "title": "COALESCE(NULLIF(sort_title,''),title)", - "artist": "COALESCE(NULLIF(sort_artist_name,''),order_artist_name) asc, COALESCE(NULLIF(sort_album_name,''),order_album_name) asc, release_date asc, disc_number asc, track_number asc", - "album": "COALESCE(NULLIF(sort_album_name,''),order_album_name) asc, release_date asc, disc_number asc, track_number asc, COALESCE(NULLIF(sort_artist_name,''),order_artist_name) asc, COALESCE(NULLIF(sort_title,''),title) asc", - "random": "random", - "created_at": "media_file.created_at", - "track_number": "album, release_date, disc_number, track_number", - "starred_at": "starred, starred_at", + "title": "COALESCE(NULLIF(sort_title,''),order_title)", + "artist": "COALESCE(NULLIF(sort_artist_name,''),order_artist_name) asc, COALESCE(NULLIF(sort_album_name,''),order_album_name) asc, release_date asc, disc_number asc, track_number asc", + "album": "COALESCE(NULLIF(sort_album_name,''),order_album_name) asc, release_date asc, disc_number asc, track_number asc, COALESCE(NULLIF(sort_artist_name,''),order_artist_name) asc, COALESCE(NULLIF(sort_title,''),title) asc", + "random": "random", + "created_at": "media_file.created_at", + "starred_at": "starred, starred_at", } } else { r.sortMappings = map[string]string{ - "title": "order_title", - "artist": "order_artist_name asc, order_album_name asc, release_date asc, disc_number asc, track_number asc", - "album": "order_album_name asc, release_date asc, disc_number asc, track_number asc, order_artist_name asc, title asc", - "random": "random", - "created_at": "media_file.created_at", - "track_number": "album, release_date, disc_number, track_number", - "starred_at": "starred, starred_at", + "title": "order_title", + "artist": "order_artist_name asc, order_album_name asc, release_date asc, disc_number asc, track_number asc", + "album": "order_album_name asc, release_date asc, disc_number asc, track_number asc, order_artist_name asc, title asc", + "random": "random", + "created_at": "media_file.created_at", + "starred_at": "starred, starred_at", } } return r diff --git a/persistence/player_repository.go b/persistence/player_repository.go index 381ec2ae8..98c53d141 100644 --- a/persistence/player_repository.go +++ b/persistence/player_repository.go @@ -21,6 +21,9 @@ func NewPlayerRepository(ctx context.Context, db dbx.Builder) model.PlayerReposi r.registerModel(&model.Player{}, map[string]filterFunc{ "name": containsFilter("player.name"), }) + r.sortMappings = map[string]string{ + "user_name": "username", //TODO rename all user_name and userName to username + } return r } diff --git a/persistence/playlist_repository.go b/persistence/playlist_repository.go index 422275f50..607d7d198 100644 --- a/persistence/playlist_repository.go +++ b/persistence/playlist_repository.go @@ -55,6 +55,9 @@ func NewPlaylistRepository(ctx context.Context, db dbx.Builder) model.PlaylistRe "q": playlistFilter, "smart": smartPlaylistFilter, }) + r.sortMappings = map[string]string{ + "owner_name": "owner_name", + } return r } diff --git a/persistence/share_repository.go b/persistence/share_repository.go index ca7b971c1..6b84243df 100644 --- a/persistence/share_repository.go +++ b/persistence/share_repository.go @@ -24,6 +24,9 @@ func NewShareRepository(ctx context.Context, db dbx.Builder) model.ShareReposito r.ctx = ctx r.db = db r.registerModel(&model.Share{}, map[string]filterFunc{}) + r.sortMappings = map[string]string{ + "username": "username", + } return r }