1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00
focalboard/server/model/services_api.go
Doug Lauder 605c0079eb
Multi product architecture (#3309)
* skeleton lifecycle

* bare minimum to satisfy mm-server import

* added boards_imports.go

* move boards_imports.go to correct package

* bump mmserver version; remove replace in go.mod; use module workspaces; remove logger service

* rename product.go --> boards.go

* add FileInfoStore and Cloud services for product; create minimal pluginAPI interfaces for all packages

* rename Boards -> BoardsProduct

* compile success

* remove hooks service; guard for nil BoardsApp

* update to latest mmserver ver

* upgrade mmserver to master tip

* upgrade mmserver to master tip

* bump plugin-api to master tip

* fix users service

* fix OnActivate crash; normalize AppError returns

* fileBackend interface for server/app

* feature flag

* bump mmserver version

* fix linter errors

* make go.work when linting

* fix go.work creation for CI

* add execute flag for script

* fix more linter errors

* always create a go.work

* fix ci go.work

* OS agnostic go.work generator

* fix path

* fix path again

* partially disable cypress test

* fix case Id --> ID

* bump mmserver version

* include  in go.work for dev

* addressed review comments.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-15 07:51:50 +02:00

71 lines
2.3 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
//go:generate mockgen --build_flags= -destination=mocks/mockservicesapi.go -package mocks . ServicesAPI
package model
import (
"database/sql"
mm_model "github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type ServicesAPI interface {
// Channels service
GetDirectChannel(userID1, userID2 string) (*mm_model.Channel, error)
GetChannelByID(channelID string) (*mm_model.Channel, error)
GetChannelMember(channelID string, userID string) (*mm_model.ChannelMember, error)
GetChannelsForTeamForUser(teamID string, userID string, includeDeleted bool) (mm_model.ChannelList, error)
// Post service
CreatePost(post *mm_model.Post) (*mm_model.Post, error)
// User service
GetUserByID(userID string) (*mm_model.User, error)
GetUserByUsername(name string) (*mm_model.User, error)
GetUserByEmail(email string) (*mm_model.User, error)
UpdateUser(user *mm_model.User) (*mm_model.User, error)
GetUsersFromProfiles(options *mm_model.UserGetOptions) ([]*mm_model.User, error)
// Team service
GetTeamMember(teamID string, userID string) (*mm_model.TeamMember, error)
CreateMember(teamID string, userID string) (*mm_model.TeamMember, error)
// Permissions service
HasPermissionToTeam(userID, teamID string, permission *mm_model.Permission) bool
HasPermissionToChannel(askingUserID string, channelID string, permission *mm_model.Permission) bool
// Bot service
EnsureBot(bot *mm_model.Bot) (string, error)
// License service
GetLicense() *mm_model.License
// FileInfoStore service
GetFileInfo(fileID string) (*mm_model.FileInfo, error)
// Cluster service
PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *mm_model.WebsocketBroadcast)
PublishPluginClusterEvent(ev mm_model.PluginClusterEvent, opts mm_model.PluginClusterEventSendOptions) error
// Cloud service
GetCloudLimits() (*mm_model.ProductLimits, error)
// Config service
GetConfig() *mm_model.Config
// Logger service
GetLogger() mlog.LoggerIFace
// KVStore service
KVSetWithOptions(key string, value []byte, options mm_model.PluginKVSetOptions) (bool, error)
// Store service
GetMasterDB() (*sql.DB, error)
// System service
GetDiagnosticID() string
}