Add nested resource playlist/{id}/tracks

This commit is contained in:
Deluan 2020-05-08 23:48:06 -04:00 committed by Deluan Quintão
parent a56e588c8e
commit aebee651ac
4 changed files with 121 additions and 7 deletions

View file

@ -1,6 +1,10 @@
package model
import "time"
import (
"time"
"github.com/deluan/rest"
)
type Playlist struct {
ID string `json:"id" orm:"column(id)"`
@ -22,6 +26,18 @@ type PlaylistRepository interface {
Get(id string) (*Playlist, error)
GetAll(options ...QueryOptions) (Playlists, error)
Delete(id string) error
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
}
type Playlists []Playlist