Add new PrefSortTags option (#2696)

This commit is contained in:
Deluan Quintão
2023-12-11 20:37:11 -05:00
committed by GitHub
parent d3669f46a9
commit ab53313273
4 changed files with 38 additions and 14 deletions
+9 -3
View File
@@ -60,14 +60,20 @@ func NewArtistRepository(ctx context.Context, db dbx.Builder) model.ArtistReposi
r.db = db
r.indexGroups = utils.ParseIndexGroups(conf.Server.IndexGroups)
r.tableName = "artist"
r.sortMappings = map[string]string{
"name": "order_artist_name",
}
r.filterMappings = map[string]filterFunc{
"id": idFilter(r.tableName),
"name": fullTextFilter,
"starred": booleanFilter,
}
if conf.Server.PreferSortTags {
r.sortMappings = map[string]string{
"name": "COALESCE(NULLIF(sort_artist_name,''),order_artist_name)",
}
} else {
r.sortMappings = map[string]string{
"name": "order_artist_name",
}
}
return r
}