navidrome/model/playlist.go

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

52 lines
1.6 KiB
Go
Raw Normal View History

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