Add new functions to channel service and kv store service interfaces
Этот коммит содержится в:
2
Makefile
2
Makefile
@@ -200,7 +200,7 @@ endif
|
|||||||
|
|
||||||
# Playbooks
|
# Playbooks
|
||||||
BUILD_PLAYBOOKS_DIR ?= ../mattermost-plugin-playbooks
|
BUILD_PLAYBOOKS_DIR ?= ../mattermost-plugin-playbooks
|
||||||
BUILD_PLAYBOOKS ?= false
|
BUILD_PLAYBOOKS ?= true
|
||||||
|
|
||||||
ifeq ($(BUILD_PLAYBOOKS),true)
|
ifeq ($(BUILD_PLAYBOOKS),true)
|
||||||
IGNORE:=$(shell cp $(BUILD_PLAYBOOKS_DIR)/product/imports/playbooks_imports.go imports/)
|
IGNORE:=$(shell cp $(BUILD_PLAYBOOKS_DIR)/product/imports/playbooks_imports.go imports/)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import (
|
|||||||
// channelsWrapper provides an implementation of `product.ChannelService` to be used by products.
|
// channelsWrapper provides an implementation of `product.ChannelService` to be used by products.
|
||||||
type channelsWrapper struct {
|
type channelsWrapper struct {
|
||||||
srv *Server
|
srv *Server
|
||||||
|
app *App
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *channelsWrapper) GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError) {
|
func (s *channelsWrapper) GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError) {
|
||||||
@@ -47,6 +48,22 @@ func (s *channelsWrapper) GetChannelsForTeamForUser(teamID string, userID string
|
|||||||
return s.srv.getChannelsForTeamForUser(request.EmptyContext(s.srv.Log()), teamID, userID, opts)
|
return s.srv.getChannelsForTeamForUser(request.EmptyContext(s.srv.Log()), teamID, userID, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *channelsWrapper) GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) {
|
||||||
|
return s.app.GetSidebarCategoriesForTeamForUser(request.EmptyContext(s.srv.Log()), userID, teamID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *channelsWrapper) GetChannelMembers(channelID string, page, perPage int) (model.ChannelMembers, *model.AppError) {
|
||||||
|
return s.app.GetChannelMembersPage(request.EmptyContext(s.srv.Log()), channelID, page, perPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *channelsWrapper) CreateChannelSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError) {
|
||||||
|
return s.app.CreateSidebarCategory(request.EmptyContext(s.srv.Log()), userID, teamID, newCategory)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *channelsWrapper) UpdateChannelSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError) {
|
||||||
|
return s.app.UpdateSidebarCategories(request.EmptyContext(s.srv.Log()), userID, teamID, categories)
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure the wrapper implements the product service.
|
// Ensure the wrapper implements the product service.
|
||||||
var _ product.ChannelService = (*channelsWrapper)(nil)
|
var _ product.ChannelService = (*channelsWrapper)(nil)
|
||||||
|
|
||||||
|
|||||||
@@ -262,8 +262,9 @@ func NewServer(options ...Option) (*Server, error) {
|
|||||||
// ensure app implements `product.UserService`
|
// ensure app implements `product.UserService`
|
||||||
var _ product.UserService = (*App)(nil)
|
var _ product.UserService = (*App)(nil)
|
||||||
|
|
||||||
|
app := New(ServerConnector(s.Channels()))
|
||||||
serviceMap := map[ServiceKey]any{
|
serviceMap := map[ServiceKey]any{
|
||||||
ChannelKey: &channelsWrapper{srv: s},
|
ChannelKey: &channelsWrapper{srv: s, app: app},
|
||||||
ConfigKey: s.platform,
|
ConfigKey: s.platform,
|
||||||
LicenseKey: s.licenseWrapper,
|
LicenseKey: s.licenseWrapper,
|
||||||
FilestoreKey: s.platform.FileBackend(),
|
FilestoreKey: s.platform.FileBackend(),
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ type ChannelService interface {
|
|||||||
GetChannelByID(channelID string) (*model.Channel, *model.AppError)
|
GetChannelByID(channelID string) (*model.Channel, *model.AppError)
|
||||||
GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError)
|
GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError)
|
||||||
GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError)
|
GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError)
|
||||||
|
GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError)
|
||||||
|
GetChannelMembers(channelID string, page, perPage int) (model.ChannelMembers, *model.AppError)
|
||||||
|
CreateChannelSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)
|
||||||
|
UpdateChannelSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LicenseService provides license related utilities.
|
// LicenseService provides license related utilities.
|
||||||
@@ -161,6 +165,8 @@ type CloudService interface {
|
|||||||
type KVStoreService interface {
|
type KVStoreService interface {
|
||||||
SetPluginKeyWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
|
SetPluginKeyWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
|
||||||
KVGet(productID, key string) ([]byte, *model.AppError)
|
KVGet(productID, key string) ([]byte, *model.AppError)
|
||||||
|
KVDelete(productID, key string) *model.AppError
|
||||||
|
KVList(productID string, page, perPage int) ([]string, *model.AppError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogService is the API for accessing the log service APIs.
|
// LogService is the API for accessing the log service APIs.
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user