implement get and set play queue

This commit is contained in:
sentriz
2020-02-09 16:50:02 +00:00
parent 04159e536e
commit c84420fa4f
4 changed files with 71 additions and 1 deletions

View File

@@ -155,3 +155,23 @@ func (p *Playlist) SetItems(items []int) {
p.Items = joinInt(items, ",")
p.TrackCount = len(items)
}
type PlayQueue struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
User *User
UserID int `sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
Current int
Position int
ChangedBy string
Items string
}
func (p *PlayQueue) GetItems() []int {
return splitInt(p.Items, ",")
}
func (p *PlayQueue) SetItems(items []int) {
p.Items = joinInt(items, ",")
}