Purge empty albums/artists

This commit is contained in:
Deluan
2020-01-17 23:28:11 -05:00
parent ea9ed4a287
commit 54d13d2022
5 changed files with 24 additions and 0 deletions
+6
View File
@@ -160,6 +160,12 @@ func (r *artistRepository) PurgeInactive(activeList model.Artists) error {
})
}
func (r *artistRepository) PurgeEmpty() error {
o := Db()
_, err := o.Raw("delete from artist where id not in (select distinct(artist_id) from album)").Exec()
return err
}
func (r *artistRepository) Search(q string, offset int, size int) (model.Artists, error) {
if len(q) <= 2 {
return nil, nil