Implement album lists

This commit is contained in:
Deluan
2020-07-28 08:49:28 -04:00
committed by Deluan Quintão
parent d877928f11
commit db8a48bba6
5 changed files with 86 additions and 12 deletions
+10 -5
View File
@@ -36,15 +36,20 @@ func NewAlbumRepository(ctx context.Context, o orm.Ormer) model.AlbumRepository
"max_year": "max_year asc, name, order_album_name asc",
}
r.filterMappings = map[string]filterFunc{
"name": fullTextFilter,
"compilation": booleanFilter,
"artist_id": artistFilter,
"year": yearFilter,
"name": fullTextFilter,
"compilation": booleanFilter,
"artist_id": artistFilter,
"year": yearFilter,
"recently_played": recentlyPlayedFilter,
}
return r
}
func recentlyPlayedFilter(field string, value interface{}) Sqlizer {
return Gt{"play_count": 0}
}
func yearFilter(field string, value interface{}) Sqlizer {
return Or{
And{
@@ -67,7 +72,7 @@ func artistFilter(field string, value interface{}) Sqlizer {
}
func (r *albumRepository) CountAll(options ...model.QueryOptions) (int64, error) {
return r.count(Select(), options...)
return r.count(r.selectAlbum(options...))
}
func (r *albumRepository) Exists(id string) (bool, error) {