Playlist: Use a different go struct for sql service vs k8s (#76393)
This commit is contained in:
@@ -4,9 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/playlist"
|
||||
"github.com/grafana/grafana/pkg/services/store/entity"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
@@ -15,11 +13,10 @@ type Service struct {
|
||||
|
||||
var _ playlist.Service = &Service{}
|
||||
|
||||
func ProvideService(db db.DB, toggles featuremgmt.FeatureToggles, objserver entity.EntityStoreServer) playlist.Service {
|
||||
sqlstore := &sqlStore{
|
||||
func ProvideService(db db.DB) playlist.Service {
|
||||
return &Service{store: &sqlStore{
|
||||
db: db,
|
||||
}
|
||||
return &Service{store: sqlstore}
|
||||
}}
|
||||
}
|
||||
|
||||
func (s *Service) Create(ctx context.Context, cmd *playlist.CreatePlaylistCommand) (*playlist.Playlist, error) {
|
||||
@@ -48,7 +45,7 @@ func (s *Service) Get(ctx context.Context, q *playlist.GetPlaylistByUidQuery) (*
|
||||
}
|
||||
items := make([]playlist.PlaylistItemDTO, len(rawItems))
|
||||
for i := 0; i < len(rawItems); i++ {
|
||||
items[i].Type = playlist.PlaylistItemType(rawItems[i].Type)
|
||||
items[i].Type = rawItems[i].Type
|
||||
items[i].Value = rawItems[i].Value
|
||||
|
||||
// Add the unused title to the result
|
||||
@@ -58,10 +55,13 @@ func (s *Service) Get(ctx context.Context, q *playlist.GetPlaylistByUidQuery) (*
|
||||
}
|
||||
}
|
||||
return &playlist.PlaylistDTO{
|
||||
Uid: v.UID,
|
||||
Name: v.Name,
|
||||
Interval: v.Interval,
|
||||
Items: items,
|
||||
Uid: v.UID,
|
||||
Name: v.Name,
|
||||
Interval: v.Interval,
|
||||
Items: items,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
OrgID: v.OrgId,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user