From 9fc64e1dcb96b2813f49f6f11b7312c30e61f470 Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 18 Jun 2020 22:55:39 +0100 Subject: [PATCH] Remove spec playlist constructor --- server/ctrlsubsonic/handlers_playlist.go | 10 +++++++--- server/ctrlsubsonic/spec/construct.go | 16 ---------------- 2 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 server/ctrlsubsonic/spec/construct.go diff --git a/server/ctrlsubsonic/handlers_playlist.go b/server/ctrlsubsonic/handlers_playlist.go index 89f1b18..2d74f7f 100644 --- a/server/ctrlsubsonic/handlers_playlist.go +++ b/server/ctrlsubsonic/handlers_playlist.go @@ -16,9 +16,13 @@ func playlistRender(c *Controller, playlist *db.Playlist) *spec.Playlist { user := &db.User{} c.DB.Where("id=?", playlist.UserID).Find(user) // - resp := spec.NewPlaylist(playlist) - resp.Owner = user.Name - resp.SongCount = playlist.TrackCount + resp := &spec.Playlist{ + ID: playlist.ID, + Name: playlist.Name, + Comment: playlist.Comment, + Created: playlist.CreatedAt, + SongCount: playlist.TrackCount, + } // trackIDs := playlist.GetItems() resp.List = make([]*spec.TrackChild, len(trackIDs)) diff --git a/server/ctrlsubsonic/spec/construct.go b/server/ctrlsubsonic/spec/construct.go deleted file mode 100644 index c8ebd24..0000000 --- a/server/ctrlsubsonic/spec/construct.go +++ /dev/null @@ -1,16 +0,0 @@ -package spec - -import ( - "go.senan.xyz/gonic/server/db" -) - -func NewPlaylist(p *db.Playlist) *Playlist { - return &Playlist{ - ID: p.ID, - Name: p.Name, - Comment: p.Comment, - Duration: 1, - Public: true, - Created: p.CreatedAt, - } -}