2015-12-22 04:07:15 -06:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Typed errors
|
|
|
|
var (
|
|
|
|
ErrPlaylistNotFound = errors.New("Playlist not found")
|
|
|
|
ErrPlaylistWithSameNameExists = errors.New("A playlist with the same name already exists")
|
|
|
|
)
|
|
|
|
|
|
|
|
// Playlist model
|
|
|
|
type Playlist struct {
|
2016-01-08 10:32:55 -06:00
|
|
|
Id int64 `json:"id"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Timespan string `json:"timespan"`
|
|
|
|
OrgId int64 `json:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PlaylistDTO struct {
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Timespan string `json:"timespan"`
|
|
|
|
OrgId int64 `json:"-"`
|
|
|
|
Items []PlaylistItemDTO `json:"items"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PlaylistItemDTO struct {
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
PlaylistId int64 `json:"playlistid"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
Order int `json:"order"`
|
2015-12-22 04:07:15 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type PlaylistDashboard struct {
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
Slug string `json:"slug"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
}
|
|
|
|
|
2016-01-08 10:32:55 -06:00
|
|
|
type PlaylistItem struct {
|
|
|
|
Id int64
|
|
|
|
PlaylistId int64
|
|
|
|
Type string
|
|
|
|
Value string
|
|
|
|
Order int
|
|
|
|
Title string
|
|
|
|
}
|
|
|
|
|
2015-12-22 04:07:15 -06:00
|
|
|
func (this PlaylistDashboard) TableName() string {
|
|
|
|
return "dashboard"
|
|
|
|
}
|
|
|
|
|
|
|
|
type Playlists []*Playlist
|
|
|
|
type PlaylistDashboards []*PlaylistDashboard
|
|
|
|
|
2016-01-08 09:13:49 -06:00
|
|
|
//
|
|
|
|
// DTOS
|
|
|
|
//
|
|
|
|
|
|
|
|
type PlaylistDashboardDto struct {
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
Slug string `json:"slug"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Uri string `json:"uri"`
|
|
|
|
}
|
|
|
|
|
2015-12-22 04:07:15 -06:00
|
|
|
//
|
|
|
|
// COMMANDS
|
|
|
|
//
|
|
|
|
type PlaylistQuery struct {
|
|
|
|
Title string
|
|
|
|
Limit int
|
|
|
|
OrgId int64
|
|
|
|
|
|
|
|
Result Playlists
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpdatePlaylistQuery struct {
|
|
|
|
Id int64
|
|
|
|
Title string
|
|
|
|
Type string
|
|
|
|
Timespan string
|
2016-01-08 10:32:55 -06:00
|
|
|
Items []PlaylistItemDTO
|
2015-12-22 04:07:15 -06:00
|
|
|
|
2016-01-08 10:32:55 -06:00
|
|
|
Result *PlaylistDTO
|
2015-12-22 04:07:15 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type CreatePlaylistQuery struct {
|
|
|
|
Title string
|
|
|
|
Type string
|
|
|
|
Timespan string
|
2016-01-04 19:14:39 -06:00
|
|
|
Data []int64
|
2015-12-22 04:07:15 -06:00
|
|
|
OrgId int64
|
2016-01-08 10:32:55 -06:00
|
|
|
Items []PlaylistItemDTO
|
2015-12-22 04:07:15 -06:00
|
|
|
|
|
|
|
Result *Playlist
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetPlaylistByIdQuery struct {
|
|
|
|
Id int64
|
|
|
|
Result *Playlist
|
|
|
|
}
|
|
|
|
|
2016-01-08 10:32:55 -06:00
|
|
|
type GetPlaylistItemsByIdQuery struct {
|
|
|
|
PlaylistId int64
|
|
|
|
Result *[]PlaylistItem
|
|
|
|
}
|
|
|
|
|
2015-12-22 04:07:15 -06:00
|
|
|
type GetPlaylistDashboardsQuery struct {
|
2016-01-08 10:32:55 -06:00
|
|
|
DashboardIds []int64
|
|
|
|
Result *PlaylistDashboards
|
2015-12-22 04:07:15 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type DeletePlaylistQuery struct {
|
|
|
|
Id int64
|
|
|
|
}
|