Remove spec playlist constructor
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user