Make MediaFolder ID int32

This commit is contained in:
Deluan 2020-05-09 22:29:02 -04:00
parent 1ed6d130b1
commit 0d1e2a92f6
3 changed files with 3 additions and 7 deletions

View file

@ -1,8 +1,7 @@
package model package model
type MediaFolder struct { type MediaFolder struct {
// TODO Change to int ID int32
ID string
Name string Name string
Path string Path string
} }

View file

@ -29,7 +29,7 @@ func (*mediaFolderRepository) GetAll() (model.MediaFolders, error) {
} }
func hardCoded() model.MediaFolder { func hardCoded() model.MediaFolder {
mediaFolder := model.MediaFolder{ID: "0", Path: conf.Server.MusicFolder} mediaFolder := model.MediaFolder{ID: 0, Path: conf.Server.MusicFolder}
mediaFolder.Name = "Music Library" mediaFolder.Name = "Music Library"
return mediaFolder return mediaFolder
} }

View file

@ -3,7 +3,6 @@ package subsonic
import ( import (
"context" "context"
"net/http" "net/http"
"strconv"
"time" "time"
"github.com/deluan/navidrome/conf" "github.com/deluan/navidrome/conf"
@ -26,9 +25,7 @@ func (c *BrowsingController) GetMusicFolders(w http.ResponseWriter, r *http.Requ
mediaFolderList, _ := c.browser.MediaFolders(r.Context()) mediaFolderList, _ := c.browser.MediaFolders(r.Context())
folders := make([]responses.MusicFolder, len(mediaFolderList)) folders := make([]responses.MusicFolder, len(mediaFolderList))
for i, f := range mediaFolderList { for i, f := range mediaFolderList {
// TODO Change model.MediaFolder.ID to int folders[i].Id = f.ID
id, _ := strconv.ParseInt(f.ID, 10, 32)
folders[i].Id = int32(id)
folders[i].Name = f.Name folders[i].Name = f.Name
} }
response := NewResponse() response := NewResponse()