Add `has_rating` filter to albums

This commit is contained in:
Deluan 2021-04-07 11:04:36 -04:00
parent 10dcc3fb37
commit 5178f44094
1 changed files with 5 additions and 0 deletions

View File

@ -44,6 +44,7 @@ func NewAlbumRepository(ctx context.Context, o orm.Ormer) model.AlbumRepository
"year": yearFilter,
"recently_played": recentlyPlayedFilter,
"starred": booleanFilter,
"has_rating": hasRatingFilter,
}
return r
@ -60,6 +61,10 @@ func recentlyPlayedFilter(field string, value interface{}) Sqlizer {
return Gt{"play_count": 0}
}
func hasRatingFilter(field string, value interface{}) Sqlizer {
return Gt{"rating": 0}
}
func yearFilter(field string, value interface{}) Sqlizer {
return Or{
And{