2015-12-03 01:52:37 -06:00
|
|
|
package models
|
|
|
|
|
2016-01-20 21:41:02 -06:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-11-05 06:07:06 -06:00
|
|
|
ErrPluginSettingNotFound = errors.New("plugin setting not found")
|
2016-01-20 21:41:02 -06:00
|
|
|
)
|
2015-12-03 09:43:55 -06:00
|
|
|
|
2016-02-25 07:55:31 -06:00
|
|
|
type PluginSetting struct {
|
2016-01-22 16:17:22 -06:00
|
|
|
Id int64
|
2016-02-25 07:55:31 -06:00
|
|
|
PluginId string
|
2016-01-22 16:17:22 -06:00
|
|
|
OrgId int64
|
|
|
|
Enabled bool
|
|
|
|
Pinned bool
|
|
|
|
JsonData map[string]interface{}
|
2021-10-07 09:33:50 -05:00
|
|
|
SecureJsonData map[string][]byte
|
2016-07-07 11:11:03 -05:00
|
|
|
PluginVersion string
|
2015-12-03 09:43:55 -06:00
|
|
|
|
|
|
|
Created time.Time
|
|
|
|
Updated time.Time
|
|
|
|
}
|
|
|
|
|
2022-09-21 05:20:11 -05:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2015-12-03 09:43:55 -06:00
|
|
|
// ----------------------
|
|
|
|
// COMMANDS
|
|
|
|
|
|
|
|
// Also acts as api DTO
|
2016-02-25 07:55:31 -06:00
|
|
|
type UpdatePluginSettingCmd struct {
|
2016-01-22 16:17:22 -06:00
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
Pinned bool `json:"pinned"`
|
|
|
|
JsonData map[string]interface{} `json:"jsonData"`
|
|
|
|
SecureJsonData map[string]string `json:"secureJsonData"`
|
2016-07-07 11:11:03 -05:00
|
|
|
PluginVersion string `json:"version"`
|
2015-12-03 09:43:55 -06:00
|
|
|
|
2021-10-07 09:33:50 -05:00
|
|
|
PluginId string `json:"-"`
|
|
|
|
OrgId int64 `json:"-"`
|
|
|
|
EncryptedSecureJsonData map[string][]byte `json:"-"`
|
2015-12-03 09:43:55 -06:00
|
|
|
}
|
|
|
|
|
2016-07-07 11:11:03 -05:00
|
|
|
// specific command, will only update version
|
|
|
|
type UpdatePluginSettingVersionCmd struct {
|
|
|
|
PluginVersion string
|
|
|
|
PluginId string `json:"-"`
|
|
|
|
OrgId int64 `json:"-"`
|
|
|
|
}
|
|
|
|
|
2015-12-03 09:43:55 -06:00
|
|
|
// ---------------------
|
|
|
|
// QUERIES
|
2016-03-08 11:17:47 -06:00
|
|
|
|
|
|
|
type PluginSettingInfoDTO struct {
|
2016-07-07 11:11:03 -05:00
|
|
|
OrgId int64
|
|
|
|
PluginId string
|
|
|
|
Enabled bool
|
|
|
|
Pinned bool
|
|
|
|
PluginVersion string
|
2015-12-03 01:52:37 -06:00
|
|
|
}
|
2016-01-20 21:41:02 -06:00
|
|
|
|
2016-02-25 07:55:31 -06:00
|
|
|
type GetPluginSettingByIdQuery struct {
|
|
|
|
PluginId string
|
|
|
|
OrgId int64
|
|
|
|
Result *PluginSetting
|
2016-01-20 21:41:02 -06:00
|
|
|
}
|
2016-07-08 05:26:51 -05:00
|
|
|
|
|
|
|
type PluginStateChangedEvent struct {
|
|
|
|
PluginId string
|
|
|
|
OrgId int64
|
|
|
|
Enabled bool
|
|
|
|
}
|