refactor: adding back artist and album tables

This commit is contained in:
Deluan
2020-01-31 09:53:19 -05:00
committed by Deluan Quintão
parent d389d40db1
commit f5071d1614
14 changed files with 208 additions and 92 deletions
+2 -12
View File
@@ -49,18 +49,8 @@ func (r *playlistRepository) Put(p *model.Playlist) error {
id, _ := uuid.NewRandom()
p.ID = id.String()
}
values, _ := toSqlArgs(r.fromModel(p))
update := Update(r.tableName).Where(Eq{"id": p.ID}).SetMap(values)
count, err := r.executeSQL(update)
if err != nil {
return err
}
if count > 0 {
return nil
}
insert := Insert(r.tableName).SetMap(values)
_, err = r.executeSQL(insert)
return err
pls := r.fromModel(p)
return r.put(p.ID, &pls)
}
func (r *playlistRepository) Get(id string) (*model.Playlist, error) {