mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-05 13:37:38 +03:00
fix(ui): sort mappings (#3296)
* fix(ui): update sort mapping for title in mediafile repository * fix(ui): create sort mapping for username in share repository * fix(ui): create sort mapping for owner_name in playlist repository * fix(ui): create sort mapping for username in player repository * fix(ui): remove sort mapping for track number in mediafile repository * chore: add todo to change user_name
This commit is contained in:
parent
e628aafa4b
commit
11d96f1da4
4 changed files with 21 additions and 14 deletions
|
@ -33,23 +33,21 @@ func NewMediaFileRepository(ctx context.Context, db dbx.Builder) *mediaFileRepos
|
||||||
})
|
})
|
||||||
if conf.Server.PreferSortTags {
|
if conf.Server.PreferSortTags {
|
||||||
r.sortMappings = map[string]string{
|
r.sortMappings = map[string]string{
|
||||||
"title": "COALESCE(NULLIF(sort_title,''),title)",
|
"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",
|
"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",
|
"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",
|
"random": "random",
|
||||||
"created_at": "media_file.created_at",
|
"created_at": "media_file.created_at",
|
||||||
"track_number": "album, release_date, disc_number, track_number",
|
"starred_at": "starred, starred_at",
|
||||||
"starred_at": "starred, starred_at",
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r.sortMappings = map[string]string{
|
r.sortMappings = map[string]string{
|
||||||
"title": "order_title",
|
"title": "order_title",
|
||||||
"artist": "order_artist_name asc, order_album_name asc, release_date asc, disc_number asc, track_number asc",
|
"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",
|
"album": "order_album_name asc, release_date asc, disc_number asc, track_number asc, order_artist_name asc, title asc",
|
||||||
"random": "random",
|
"random": "random",
|
||||||
"created_at": "media_file.created_at",
|
"created_at": "media_file.created_at",
|
||||||
"track_number": "album, release_date, disc_number, track_number",
|
"starred_at": "starred, starred_at",
|
||||||
"starred_at": "starred, starred_at",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
|
|
|
@ -21,6 +21,9 @@ func NewPlayerRepository(ctx context.Context, db dbx.Builder) model.PlayerReposi
|
||||||
r.registerModel(&model.Player{}, map[string]filterFunc{
|
r.registerModel(&model.Player{}, map[string]filterFunc{
|
||||||
"name": containsFilter("player.name"),
|
"name": containsFilter("player.name"),
|
||||||
})
|
})
|
||||||
|
r.sortMappings = map[string]string{
|
||||||
|
"user_name": "username", //TODO rename all user_name and userName to username
|
||||||
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@ func NewPlaylistRepository(ctx context.Context, db dbx.Builder) model.PlaylistRe
|
||||||
"q": playlistFilter,
|
"q": playlistFilter,
|
||||||
"smart": smartPlaylistFilter,
|
"smart": smartPlaylistFilter,
|
||||||
})
|
})
|
||||||
|
r.sortMappings = map[string]string{
|
||||||
|
"owner_name": "owner_name",
|
||||||
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ func NewShareRepository(ctx context.Context, db dbx.Builder) model.ShareReposito
|
||||||
r.ctx = ctx
|
r.ctx = ctx
|
||||||
r.db = db
|
r.db = db
|
||||||
r.registerModel(&model.Share{}, map[string]filterFunc{})
|
r.registerModel(&model.Share{}, map[string]filterFunc{})
|
||||||
|
r.sortMappings = map[string]string{
|
||||||
|
"username": "username",
|
||||||
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue