navidrome/model/playlist.go

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

51 lines
1.4 KiB
Go
Raw Normal View History

2020-01-14 22:22:34 -05:00
package model
import (
"time"
)
type Playlist struct {
ID string `json:"id" orm:"column(id)"`
2020-05-08 10:47:06 -04:00
Name string `json:"name"`
Comment string `json:"comment"`
Duration float32 `json:"duration"`
2020-10-12 21:28:59 -04:00
Size int64 `json:"size"`
SongCount int `json:"songCount"`
2020-05-08 10:47:06 -04:00
Owner string `json:"owner"`
Public bool `json:"public"`
2020-05-11 10:53:09 -04:00
Tracks MediaFiles `json:"tracks,omitempty"`
2020-07-10 21:44:40 -04:00
Path string `json:"path"`
Sync bool `json:"sync"`
2020-05-08 10:47:06 -04:00
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
2020-05-15 20:47:15 -04:00
type Playlists []Playlist
type PlaylistRepository interface {
2020-05-03 20:05:03 -04: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)
FindByPath(path string) (*Playlist, error)
Delete(id string) error
2020-05-15 20:47:15 -04:00
Tracks(playlistId string) PlaylistTrackRepository
}
2020-05-15 20:47:15 -04:00
type PlaylistTrack struct {
ID string `json:"id" orm:"column(id)"`
MediaFileID string `json:"mediaFileId" orm:"column(media_file_id)"`
2020-05-15 20:47:15 -04:00
PlaylistID string `json:"playlistId" orm:"column(playlist_id)"`
MediaFile
}
2020-05-15 20:47:15 -04:00
type PlaylistTracks []PlaylistTrack
type PlaylistTrackRepository interface {
2020-05-16 18:10:08 -04:00
ResourceRepository
2020-05-15 20:47:15 -04:00
Add(mediaFileIds []string) error
Update(mediaFileIds []string) error
2020-05-16 18:10:08 -04:00
Delete(id string) error
2020-06-04 19:05:41 -04:00
Reorder(pos int, newPos int) error
}