mirror of https://github.com/grafana/grafana
chore: move plugins models into pluginsettings svc (#61944)
parent
48b620231e
commit
6e9eb0d931
@ -1,70 +0,0 @@ |
||||
package models |
||||
|
||||
import ( |
||||
"errors" |
||||
"time" |
||||
) |
||||
|
||||
var ( |
||||
ErrPluginSettingNotFound = errors.New("plugin setting not found") |
||||
) |
||||
|
||||
type PluginSetting struct { |
||||
Id int64 |
||||
PluginId string |
||||
OrgId int64 |
||||
Enabled bool |
||||
Pinned bool |
||||
JsonData map[string]interface{} |
||||
SecureJsonData map[string][]byte |
||||
PluginVersion string |
||||
|
||||
Created time.Time |
||||
Updated time.Time |
||||
} |
||||
|
||||
type PluginSettingInfo struct { |
||||
PluginID string `xorm:"plugin_id"` |
||||
OrgID int64 `xorm:"org_id"` |
||||
Enabled bool `xorm:"enabled"` |
||||
Pinned bool `xorm:"pinned"` |
||||
PluginVersion string `xorm:"plugin_id"` |
||||
} |
||||
|
||||
// ----------------------
|
||||
// COMMANDS
|
||||
|
||||
// Also acts as api DTO
|
||||
type UpdatePluginSettingCmd struct { |
||||
Enabled bool `json:"enabled"` |
||||
Pinned bool `json:"pinned"` |
||||
JsonData map[string]interface{} `json:"jsonData"` |
||||
SecureJsonData map[string]string `json:"secureJsonData"` |
||||
PluginVersion string `json:"version"` |
||||
|
||||
PluginId string `json:"-"` |
||||
OrgId int64 `json:"-"` |
||||
EncryptedSecureJsonData map[string][]byte `json:"-"` |
||||
} |
||||
|
||||
// specific command, will only update version
|
||||
type UpdatePluginSettingVersionCmd struct { |
||||
PluginVersion string |
||||
PluginId string `json:"-"` |
||||
OrgId int64 `json:"-"` |
||||
} |
||||
|
||||
// ---------------------
|
||||
// QUERIES
|
||||
|
||||
type GetPluginSettingByIdQuery struct { |
||||
PluginId string |
||||
OrgId int64 |
||||
Result *PluginSetting |
||||
} |
||||
|
||||
type PluginStateChangedEvent struct { |
||||
PluginId string |
||||
OrgId int64 |
||||
Enabled bool |
||||
} |
||||
@ -1,58 +0,0 @@ |
||||
// Code generated by mockery v2.10.0. DO NOT EDIT.
|
||||
|
||||
package mocks |
||||
|
||||
import ( |
||||
context "context" |
||||
|
||||
models "github.com/grafana/grafana/pkg/models" |
||||
"github.com/grafana/grafana/pkg/services/org" |
||||
mock "github.com/stretchr/testify/mock" |
||||
) |
||||
|
||||
// Store is an autogenerated mock type for the Store type
|
||||
type Store struct { |
||||
mock.Mock |
||||
} |
||||
|
||||
// GetOrgByNameHandler provides a mock function with given fields: ctx, query
|
||||
func (_m *Store) GetOrgByNameHandler(ctx context.Context, query *org.GetOrgByNameQuery) error { |
||||
ret := _m.Called(ctx, query) |
||||
|
||||
var r0 error |
||||
if rf, ok := ret.Get(0).(func(context.Context, *org.GetOrgByNameQuery) error); ok { |
||||
r0 = rf(ctx, query) |
||||
} else { |
||||
r0 = ret.Error(0) |
||||
} |
||||
|
||||
return r0 |
||||
} |
||||
|
||||
// GetPluginSettingById provides a mock function with given fields: ctx, query
|
||||
func (_m *Store) GetPluginSettingById(ctx context.Context, query *models.GetPluginSettingByIdQuery) error { |
||||
ret := _m.Called(ctx, query) |
||||
|
||||
var r0 error |
||||
if rf, ok := ret.Get(0).(func(context.Context, *models.GetPluginSettingByIdQuery) error); ok { |
||||
r0 = rf(ctx, query) |
||||
} else { |
||||
r0 = ret.Error(0) |
||||
} |
||||
|
||||
return r0 |
||||
} |
||||
|
||||
// UpdatePluginSetting provides a mock function with given fields: ctx, cmd
|
||||
func (_m *Store) UpdatePluginSetting(ctx context.Context, cmd *models.UpdatePluginSettingCmd) error { |
||||
ret := _m.Called(ctx, cmd) |
||||
|
||||
var r0 error |
||||
if rf, ok := ret.Get(0).(func(context.Context, *models.UpdatePluginSettingCmd) error); ok { |
||||
r0 = rf(ctx, cmd) |
||||
} else { |
||||
r0 = ret.Error(0) |
||||
} |
||||
|
||||
return r0 |
||||
} |
||||
Loading…
Reference in new issue