Chore: Replace entity GRN with infra/grn GRN (#74198)
replace entity GRN with infra/grn GRN
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/appcontext"
|
||||
"github.com/grafana/grafana/pkg/infra/grn"
|
||||
"github.com/grafana/grafana/pkg/services/playlist"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
||||
"github.com/grafana/grafana/pkg/services/store/entity"
|
||||
@@ -55,10 +56,10 @@ func (s *entityStoreImpl) sync() {
|
||||
}
|
||||
body, _ := json.Marshal(dto)
|
||||
_, _ = s.store.Write(ctx, &entity.WriteEntityRequest{
|
||||
GRN: &entity.GRN{
|
||||
TenantId: info.OrgID,
|
||||
UID: info.UID,
|
||||
Kind: entity.StandardKindPlaylist,
|
||||
GRN: &grn.GRN{
|
||||
TenantID: info.OrgID,
|
||||
ResourceIdentifier: info.UID,
|
||||
ResourceKind: entity.StandardKindPlaylist,
|
||||
},
|
||||
Body: body,
|
||||
})
|
||||
@@ -73,9 +74,9 @@ func (s *entityStoreImpl) Create(ctx context.Context, cmd *playlist.CreatePlayli
|
||||
return rsp, fmt.Errorf("unable to write playlist to store")
|
||||
}
|
||||
_, err = s.store.Write(ctx, &entity.WriteEntityRequest{
|
||||
GRN: &entity.GRN{
|
||||
Kind: entity.StandardKindPlaylist,
|
||||
UID: rsp.UID,
|
||||
GRN: &grn.GRN{
|
||||
ResourceKind: entity.StandardKindPlaylist,
|
||||
ResourceIdentifier: rsp.UID,
|
||||
},
|
||||
Body: body,
|
||||
})
|
||||
@@ -94,9 +95,9 @@ func (s *entityStoreImpl) Update(ctx context.Context, cmd *playlist.UpdatePlayli
|
||||
return rsp, fmt.Errorf("unable to write playlist to store")
|
||||
}
|
||||
_, err = s.store.Write(ctx, &entity.WriteEntityRequest{
|
||||
GRN: &entity.GRN{
|
||||
UID: rsp.Uid,
|
||||
Kind: entity.StandardKindPlaylist,
|
||||
GRN: &grn.GRN{
|
||||
ResourceIdentifier: rsp.Uid,
|
||||
ResourceKind: entity.StandardKindPlaylist,
|
||||
},
|
||||
Body: body,
|
||||
})
|
||||
@@ -111,9 +112,9 @@ func (s *entityStoreImpl) Delete(ctx context.Context, cmd *playlist.DeletePlayli
|
||||
err := s.sqlimpl.store.Delete(ctx, cmd)
|
||||
if err == nil {
|
||||
_, err = s.store.Delete(ctx, &entity.DeleteEntityRequest{
|
||||
GRN: &entity.GRN{
|
||||
UID: cmd.UID,
|
||||
Kind: entity.StandardKindPlaylist,
|
||||
GRN: &grn.GRN{
|
||||
ResourceIdentifier: cmd.UID,
|
||||
ResourceKind: entity.StandardKindPlaylist,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -142,9 +143,9 @@ func (s *entityStoreImpl) GetWithoutItems(ctx context.Context, q *playlist.GetPl
|
||||
|
||||
func (s *entityStoreImpl) Get(ctx context.Context, q *playlist.GetPlaylistByUidQuery) (*playlist.PlaylistDTO, error) {
|
||||
rsp, err := s.store.Read(ctx, &entity.ReadEntityRequest{
|
||||
GRN: &entity.GRN{
|
||||
UID: q.UID,
|
||||
Kind: entity.StandardKindPlaylist,
|
||||
GRN: &grn.GRN{
|
||||
ResourceIdentifier: q.UID,
|
||||
ResourceKind: entity.StandardKindPlaylist,
|
||||
},
|
||||
WithBody: true,
|
||||
})
|
||||
@@ -178,7 +179,7 @@ func (s *entityStoreImpl) Search(ctx context.Context, q *playlist.GetPlaylistsQu
|
||||
err = json.Unmarshal(res.Body, found)
|
||||
}
|
||||
playlists = append(playlists, &playlist.Playlist{
|
||||
UID: res.GRN.UID,
|
||||
UID: res.GRN.ResourceIdentifier,
|
||||
Name: res.Name,
|
||||
Interval: found.Interval,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user