diff --git a/mattermost-plugin/product/api_adapter.go b/mattermost-plugin/product/api_adapter.go index e129d6852..e18d0a7fb 100644 --- a/mattermost-plugin/product/api_adapter.go +++ b/mattermost-plugin/product/api_adapter.go @@ -6,6 +6,8 @@ package product import ( "database/sql" + "github.com/gorilla/mux" + "github.com/mattermost/mattermost-server/v6/app/request" mm_model "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/shared/mlog" @@ -205,5 +207,12 @@ func (a *serviceAPIAdapter) GetDiagnosticID() string { return a.api.systemService.GetDiagnosticId() } +// +// Router service. +// +func (a *serviceAPIAdapter) RegisterRouter(sub *mux.Router) { + a.api.routerService.RegisterRouter(boardsProductName, sub) +} + // Ensure the adapter implements ServicesAPI. var _ model.ServicesAPI = &serviceAPIAdapter{} diff --git a/mattermost-plugin/server/api_adapter.go b/mattermost-plugin/server/api_adapter.go index 6100d5489..e5ce64ccc 100644 --- a/mattermost-plugin/server/api_adapter.go +++ b/mattermost-plugin/server/api_adapter.go @@ -6,6 +6,7 @@ package main import ( "database/sql" + "github.com/gorilla/mux" "github.com/mattermost/focalboard/server/model" "github.com/mattermost/mattermost-server/v6/plugin" @@ -208,5 +209,12 @@ func (a *pluginAPIAdapter) GetDiagnosticID() string { return a.api.GetDiagnosticId() } +// +// Router service. +// +func (a *pluginAPIAdapter) RegisterRouter(sub *mux.Router) { + // NOOP for plugin +} + // Ensure the adapter implements ServicesAPI. var _ model.ServicesAPI = &pluginAPIAdapter{} diff --git a/mattermost-plugin/server/boards/boardsapp.go b/mattermost-plugin/server/boards/boardsapp.go index 0abb105a9..bbcc3660a 100644 --- a/mattermost-plugin/server/boards/boardsapp.go +++ b/mattermost-plugin/server/boards/boardsapp.go @@ -170,6 +170,11 @@ func (b *BoardsApp) Start() error { if err := b.server.Start(); err != nil { return fmt.Errorf("error starting Boards server: %w", err) } + + b.servicesAPI.RegisterRouter(b.server.GetRootRouter()) + + b.logger.Info("Boards product successfully started.") + return nil } diff --git a/server/model/mocks/mockservicesapi.go b/server/model/mocks/mockservicesapi.go index c2b1b7030..257b8ff60 100644 --- a/server/model/mocks/mockservicesapi.go +++ b/server/model/mocks/mockservicesapi.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + mux "github.com/gorilla/mux" model "github.com/mattermost/mattermost-server/v6/model" mlog "github.com/mattermost/mattermost-server/v6/shared/mlog" ) @@ -386,6 +387,18 @@ func (mr *MockServicesAPIMockRecorder) PublishWebSocketEvent(arg0, arg1, arg2 in return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishWebSocketEvent", reflect.TypeOf((*MockServicesAPI)(nil).PublishWebSocketEvent), arg0, arg1, arg2) } +// RegisterRouter mocks base method. +func (m *MockServicesAPI) RegisterRouter(arg0 *mux.Router) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "RegisterRouter", arg0) +} + +// RegisterRouter indicates an expected call of RegisterRouter. +func (mr *MockServicesAPIMockRecorder) RegisterRouter(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRouter", reflect.TypeOf((*MockServicesAPI)(nil).RegisterRouter), arg0) +} + // UpdateUser mocks base method. func (m *MockServicesAPI) UpdateUser(arg0 *model.User) (*model.User, error) { m.ctrl.T.Helper() diff --git a/server/model/services_api.go b/server/model/services_api.go index d7fa0f179..dcade8757 100644 --- a/server/model/services_api.go +++ b/server/model/services_api.go @@ -8,6 +8,8 @@ package model import ( "database/sql" + "github.com/gorilla/mux" + mm_model "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/shared/mlog" ) @@ -67,4 +69,7 @@ type ServicesAPI interface { // System service GetDiagnosticID() string + + // Router service + RegisterRouter(sub *mux.Router) } diff --git a/server/services/permissions/mmpermissions/mocks/mockpluginapi.go b/server/services/permissions/mmpermissions/mocks/mockpluginapi.go index 1a2c131e1..26bb2578d 100644 --- a/server/services/permissions/mmpermissions/mocks/mockpluginapi.go +++ b/server/services/permissions/mmpermissions/mocks/mockpluginapi.go @@ -457,21 +457,6 @@ func (mr *MockAPIMockRecorder) EnablePlugin(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnablePlugin", reflect.TypeOf((*MockAPI)(nil).EnablePlugin), arg0) } -// EnsureBotUser mocks base method. -func (m *MockAPI) EnsureBotUser(arg0 *model.Bot) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EnsureBotUser", arg0) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EnsureBotUser indicates an expected call of EnsureBotUser. -func (mr *MockAPIMockRecorder) EnsureBotUser(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnsureBotUser", reflect.TypeOf((*MockAPI)(nil).EnsureBotUser), arg0) -} - // ExecuteSlashCommand mocks base method. func (m *MockAPI) ExecuteSlashCommand(arg0 *model.CommandArgs) (*model.CommandResponse, error) { m.ctrl.T.Helper() @@ -696,21 +681,6 @@ func (mr *MockAPIMockRecorder) GetChannelsForTeamForUser(arg0, arg1, arg2 interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChannelsForTeamForUser", reflect.TypeOf((*MockAPI)(nil).GetChannelsForTeamForUser), arg0, arg1, arg2) } -// GetCloudLimits mocks base method. -func (m *MockAPI) GetCloudLimits() (*model.ProductLimits, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCloudLimits") - ret0, _ := ret[0].(*model.ProductLimits) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetCloudLimits indicates an expected call of GetCloudLimits. -func (mr *MockAPIMockRecorder) GetCloudLimits() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCloudLimits", reflect.TypeOf((*MockAPI)(nil).GetCloudLimits)) -} - // GetCommand mocks base method. func (m *MockAPI) GetCommand(arg0 string) (*model.Command, error) { m.ctrl.T.Helper() diff --git a/server/ws/mocks/mockpluginapi.go b/server/ws/mocks/mockpluginapi.go index 1a2c131e1..26bb2578d 100644 --- a/server/ws/mocks/mockpluginapi.go +++ b/server/ws/mocks/mockpluginapi.go @@ -457,21 +457,6 @@ func (mr *MockAPIMockRecorder) EnablePlugin(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnablePlugin", reflect.TypeOf((*MockAPI)(nil).EnablePlugin), arg0) } -// EnsureBotUser mocks base method. -func (m *MockAPI) EnsureBotUser(arg0 *model.Bot) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EnsureBotUser", arg0) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// EnsureBotUser indicates an expected call of EnsureBotUser. -func (mr *MockAPIMockRecorder) EnsureBotUser(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnsureBotUser", reflect.TypeOf((*MockAPI)(nil).EnsureBotUser), arg0) -} - // ExecuteSlashCommand mocks base method. func (m *MockAPI) ExecuteSlashCommand(arg0 *model.CommandArgs) (*model.CommandResponse, error) { m.ctrl.T.Helper() @@ -696,21 +681,6 @@ func (mr *MockAPIMockRecorder) GetChannelsForTeamForUser(arg0, arg1, arg2 interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChannelsForTeamForUser", reflect.TypeOf((*MockAPI)(nil).GetChannelsForTeamForUser), arg0, arg1, arg2) } -// GetCloudLimits mocks base method. -func (m *MockAPI) GetCloudLimits() (*model.ProductLimits, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCloudLimits") - ret0, _ := ret[0].(*model.ProductLimits) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetCloudLimits indicates an expected call of GetCloudLimits. -func (mr *MockAPIMockRecorder) GetCloudLimits() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCloudLimits", reflect.TypeOf((*MockAPI)(nil).GetCloudLimits)) -} - // GetCommand mocks base method. func (m *MockAPI) GetCommand(arg0 string) (*model.Command, error) { m.ctrl.T.Helper()