Use structs lib to map models to DB. Fix #1266

This commit is contained in:
Deluan 2021-08-01 01:21:20 -04:00
parent 344d7a4392
commit c831dc4cdf
22 changed files with 207 additions and 235 deletions

View file

@ -110,14 +110,11 @@ func (r *albumRepository) Get(id string) (*model.Album, error) {
}
func (r *albumRepository) Put(m *model.Album) error {
genres := m.Genres
m.Genres = nil
defer func() { m.Genres = genres }()
_, err := r.put(m.ID, m)
if err != nil {
return err
}
return r.updateGenres(m.ID, r.tableName, genres)
return r.updateGenres(m.ID, r.tableName, m.Genres)
}
func (r *albumRepository) GetAll(options ...model.QueryOptions) (model.Albums, error) {