Add system service for Focalboard multi product architecture (#20574)

* add system service; add GetUsers to users service
* add feature flag
Этот коммит содержится в:
Doug Lauder
2022-07-05 08:13:02 -04:00
коммит произвёл GitHub
родитель 717a4d04a9
Коммит 9cbe7dac09
5 изменённых файлов: 27 добавлений и 4 удалений

Просмотреть файл

@@ -173,3 +173,12 @@ func (a *App) SetServer(srv *Server) {
func (a *App) UpdateExpiredDNDStatuses() ([]*model.Status, error) {
return a.Srv().Store.Status().UpdateExpiredDNDStatuses()
}
// systemServiceAdapter provides a collection of system APIs for use by products.
type systemServiceAdapter struct {
server *Server
}
func (ssa *systemServiceAdapter) GetDiagnosticId() string {
return ssa.server.TelemetryId()
}

Просмотреть файл

@@ -103,6 +103,7 @@ const (
HooksKey ServiceKey = "hooks"
KVStoreKey ServiceKey = "kvstore"
StoreKey ServiceKey = "storekey"
SystemKey ServiceKey = "systemkey"
)
type Server struct {
@@ -404,6 +405,7 @@ func NewServer(options ...Option) (*Server, error) {
CloudKey: &cloudWrapper{cloud: s.Cloud},
KVStoreKey: &kvStoreWrapper{srv: s},
StoreKey: store.NewStoreServiceAdapter(s.Store),
SystemKey: &systemServiceAdapter{server: s},
}
// Step 8: Initialize products.

Просмотреть файл

@@ -34,11 +34,11 @@ type teamServiceWrapper struct {
app AppIface
}
func (w *teamServiceWrapper) GetMember(teamID, userID string) (*model.TeamMember, error) {
func (w *teamServiceWrapper) GetMember(teamID, userID string) (*model.TeamMember, *model.AppError) {
return w.app.GetTeamMember(teamID, userID)
}
func (w *teamServiceWrapper) CreateMember(ctx *request.Context, teamID, userID string) (*model.TeamMember, error) {
func (w *teamServiceWrapper) CreateMember(ctx *request.Context, teamID, userID string) (*model.TeamMember, *model.AppError) {
return w.app.AddTeamMember(ctx, teamID, userID)
}