2020-01-14 18:22:34 -09:00
|
|
|
package model
|
2016-03-09 06:09:15 -09:00
|
|
|
|
2020-05-08 19:48:06 -08:00
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/deluan/rest"
|
|
|
|
|
)
|
2020-04-11 12:45:21 -08:00
|
|
|
|
2016-03-09 06:09:15 -09:00
|
|
|
type Playlist struct {
|
2020-05-08 09:57:32 -08:00
|
|
|
ID string `json:"id" orm:"column(id)"`
|
2020-05-08 06:47:06 -08:00
|
|
|
Name string `json:"name"`
|
|
|
|
|
Comment string `json:"comment"`
|
|
|
|
|
Duration float32 `json:"duration"`
|
2020-05-08 09:57:32 -08:00
|
|
|
SongCount int `json:"songCount"`
|
2020-05-08 06:47:06 -08:00
|
|
|
Owner string `json:"owner"`
|
|
|
|
|
Public bool `json:"public"`
|
2020-05-11 06:53:09 -08:00
|
|
|
Tracks MediaFiles `json:"tracks,omitempty"`
|
2020-05-08 06:47:06 -08:00
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
2016-03-09 06:09:15 -09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PlaylistRepository interface {
|
2020-05-03 16:05:03 -08:00
|
|
|
CountAll(options ...QueryOptions) (int64, error)
|
2020-01-15 04:21:32 -09:00
|
|
|
Exists(id string) (bool, error)
|
2020-01-21 12:35:57 -09:00
|
|
|
Put(pls *Playlist) error
|
2016-03-09 06:09:15 -09:00
|
|
|
Get(id string) (*Playlist, error)
|
2020-01-11 17:38:02 -09:00
|
|
|
GetAll(options ...QueryOptions) (Playlists, error)
|
2020-01-21 12:35:57 -09:00
|
|
|
Delete(id string) error
|
2020-05-08 19:48:06 -08:00
|
|
|
Tracks(playlistId string) PlaylistTracksRepository
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PlaylistTracks struct {
|
|
|
|
|
ID string `json:"id" orm:"column(id)"`
|
|
|
|
|
MediaFileID string `json:"mediaFileId" orm:"column(media_file_id)"`
|
|
|
|
|
MediaFile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PlaylistTracksRepository interface {
|
|
|
|
|
rest.Repository
|
|
|
|
|
//rest.Persistable
|
2016-03-09 06:09:15 -09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Playlists []Playlist
|