feat: show year range in album view and match ranges in year filter. #118

This commit is contained in:
Deluan
2020-03-27 21:06:02 -04:00
parent 53e8a92fed
commit 0ca849a61a
5 changed files with 56 additions and 7 deletions
+12
View File
@@ -29,11 +29,23 @@ func NewAlbumRepository(ctx context.Context, o orm.Ormer) model.AlbumRepository
"name": fullTextFilter,
"compilation": booleanFilter,
"artist_id": artistFilter,
"year": yearFilter,
}
return r
}
func yearFilter(field string, value interface{}) Sqlizer {
return Or{
And{
Gt{"min_year": 0},
LtOrEq{"min_year": value},
GtOrEq{"max_year": value},
},
Eq{"max_year": value},
}
}
func artistFilter(field string, value interface{}) Sqlizer {
return Exists("media_file", And{
ConcatExpr("album_id=album.id"),