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