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"
|
|
|
|
|
)
|
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
|
|
|
}
|
|
|
|
|
|
2020-05-15 16:47:15 -08:00
|
|
|
type Playlists []Playlist
|
|
|
|
|
|
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-15 16:47:15 -08:00
|
|
|
Tracks(playlistId string) PlaylistTrackRepository
|
2020-05-08 19:48:06 -08:00
|
|
|
}
|
|
|
|
|
|
2020-05-15 16:47:15 -08:00
|
|
|
type PlaylistTrack struct {
|
2020-05-08 19:48:06 -08:00
|
|
|
ID string `json:"id" orm:"column(id)"`
|
|
|
|
|
MediaFileID string `json:"mediaFileId" orm:"column(media_file_id)"`
|
2020-05-15 16:47:15 -08:00
|
|
|
PlaylistID string `json:"playlistId" orm:"column(playlist_id)"`
|
2020-05-08 19:48:06 -08:00
|
|
|
MediaFile
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-15 16:47:15 -08:00
|
|
|
type PlaylistTracks []PlaylistTrack
|
|
|
|
|
|
|
|
|
|
type PlaylistTrackRepository interface {
|
2020-05-16 14:10:08 -08:00
|
|
|
ResourceRepository
|
2020-05-15 16:47:15 -08:00
|
|
|
Add(mediaFileIds []string) error
|
|
|
|
|
Update(mediaFileIds []string) error
|
2020-05-16 14:10:08 -08:00
|
|
|
Delete(id string) error
|
2020-06-04 15:05:41 -08:00
|
|
|
Reorder(pos int, newPos int) error
|
2016-03-09 06:09:15 -09:00
|
|
|
}
|