2020-10-16 19:12:53 +02:00
|
|
|
package app
|
2020-10-16 16:21:42 +02:00
|
|
|
|
2020-10-16 16:36:08 +02:00
|
|
|
import (
|
2021-02-02 21:11:21 +01:00
|
|
|
"github.com/mattermost/focalboard/server/auth"
|
2021-06-18 16:03:42 +02:00
|
|
|
"github.com/mattermost/focalboard/server/model"
|
2021-01-26 23:13:46 +01:00
|
|
|
"github.com/mattermost/focalboard/server/services/config"
|
2021-06-04 16:38:49 +02:00
|
|
|
"github.com/mattermost/focalboard/server/services/metrics"
|
2021-05-29 08:23:10 +02:00
|
|
|
"github.com/mattermost/focalboard/server/services/mlog"
|
2021-01-26 23:13:46 +01:00
|
|
|
"github.com/mattermost/focalboard/server/services/store"
|
|
|
|
"github.com/mattermost/focalboard/server/services/webhook"
|
2021-05-29 08:23:10 +02:00
|
|
|
|
2021-08-24 12:13:58 +02:00
|
|
|
"github.com/mattermost/mattermost-server/v6/shared/filestore"
|
2020-10-16 16:36:08 +02:00
|
|
|
)
|
|
|
|
|
2021-06-18 16:03:42 +02:00
|
|
|
type WebsocketServer interface {
|
|
|
|
BroadcastBlockChange(workspaceID string, block model.Block)
|
|
|
|
BroadcastBlockDelete(workspaceID, blockID, parentID string)
|
|
|
|
}
|
|
|
|
|
2021-06-11 14:24:51 +02:00
|
|
|
type Services struct {
|
2021-06-04 16:38:49 +02:00
|
|
|
Auth *auth.Auth
|
|
|
|
Store store.Store
|
|
|
|
FilesBackend filestore.FileBackend
|
|
|
|
Webhook *webhook.Client
|
|
|
|
Metrics *metrics.Metrics
|
|
|
|
Logger *mlog.Logger
|
|
|
|
}
|
|
|
|
|
2020-10-16 16:21:42 +02:00
|
|
|
type App struct {
|
2020-10-16 20:16:52 +02:00
|
|
|
config *config.Configuration
|
|
|
|
store store.Store
|
2021-02-02 21:11:21 +01:00
|
|
|
auth *auth.Auth
|
2021-06-18 16:03:42 +02:00
|
|
|
wsServer WebsocketServer
|
2021-05-24 19:06:11 +02:00
|
|
|
filesBackend filestore.FileBackend
|
2020-10-29 21:42:43 +01:00
|
|
|
webhook *webhook.Client
|
2021-06-04 16:38:49 +02:00
|
|
|
metrics *metrics.Metrics
|
2021-05-29 08:23:10 +02:00
|
|
|
logger *mlog.Logger
|
2020-10-16 19:12:53 +02:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:03:42 +02:00
|
|
|
func New(config *config.Configuration, wsServer WebsocketServer, services Services) *App {
|
2021-02-02 21:11:21 +01:00
|
|
|
return &App{
|
|
|
|
config: config,
|
2021-06-04 16:38:49 +02:00
|
|
|
store: services.Store,
|
|
|
|
auth: services.Auth,
|
2021-02-02 21:11:21 +01:00
|
|
|
wsServer: wsServer,
|
2021-06-04 16:38:49 +02:00
|
|
|
filesBackend: services.FilesBackend,
|
|
|
|
webhook: services.Webhook,
|
|
|
|
metrics: services.Metrics,
|
|
|
|
logger: services.Logger,
|
2021-02-02 21:11:21 +01:00
|
|
|
}
|
2020-10-16 16:21:42 +02:00
|
|
|
}
|