quintodrome/model/playlist.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.3 KiB
Go
Raw Normal View History

2020-01-14 18:22:34 -09:00
package model
import (
"time"
)
type Playlist struct {
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"`
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"`
}
2020-05-15 16:47:15 -08:00
type Playlists []Playlist
type PlaylistRepository interface {
2020-05-03 16:05:03 -08:00
CountAll(options ...QueryOptions) (int64, error)
Exists(id string) (bool, error)
Put(pls *Playlist) error
Get(id string) (*Playlist, error)
GetAll(options ...QueryOptions) (Playlists, error)
Delete(id string) error
2020-05-15 16:47:15 -08:00
Tracks(playlistId string) PlaylistTrackRepository
}
2020-05-15 16:47:15 -08:00
type PlaylistTrack struct {
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)"`
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
}