Remove unnecessary repositories methods

This commit is contained in:
Deluan 2021-07-16 17:39:00 -04:00 committed by Deluan Quintão
parent 5e54925520
commit 1d8607ef6a
9 changed files with 23 additions and 64 deletions

View file

@ -116,15 +116,6 @@ func (r *albumRepository) Put(m *model.Album) error {
return r.updateGenres(m.ID, r.tableName, genres)
}
func (r *albumRepository) FindByArtist(artistId string) (model.Albums, error) {
options := model.QueryOptions{
Sort: "max_year",
Filters: Eq{"album_artist_id": artistId},
}
return r.GetAll(options)
}
func (r *albumRepository) GetAll(options ...model.QueryOptions) (model.Albums, error) {
sq := r.selectAlbum(options...).
LeftJoin("album_genres ag on album.id = ag.album_id").
@ -139,15 +130,6 @@ func (r *albumRepository) GetAll(options ...model.QueryOptions) (model.Albums, e
return res, err
}
// TODO Keep order when paginating
func (r *albumRepository) GetRandom(options ...model.QueryOptions) (model.Albums, error) {
if len(options) == 0 {
options = []model.QueryOptions{{}}
}
options[0].Sort = "random()"
return r.GetAll(options...)
}
// Return a map of mediafiles that have embedded covers for the given album ids
func (r *albumRepository) getEmbeddedCovers(ids []string) (map[string]model.MediaFile, error) {
var mfs model.MediaFiles