Move cluster, webhub and store out of Server (#20899)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-10-06 11:04:21 +03:00
коммит произвёл GitHub
родитель 203df2f537
Коммит 5e69c6b02f
222 изменённых файлов: 9093 добавлений и 7710 удалений

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

@@ -17,7 +17,7 @@ import (
)
func (a *App) GetRole(id string) (*model.Role, *model.AppError) {
role, err := a.Srv().Store.Role().Get(id)
role, err := a.Srv().Store().Role().Get(id)
if err != nil {
var nfErr *store.ErrNotFound
switch {
@@ -37,7 +37,7 @@ func (a *App) GetRole(id string) (*model.Role, *model.AppError) {
}
func (a *App) GetAllRoles() ([]*model.Role, *model.AppError) {
roles, err := a.Srv().Store.Role().GetAll()
roles, err := a.Srv().Store().Role().GetAll()
if err != nil {
return nil, model.NewAppError("GetAllRoles", "app.role.get_all.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
@@ -51,7 +51,7 @@ func (a *App) GetAllRoles() ([]*model.Role, *model.AppError) {
}
func (s *Server) GetRoleByName(ctx context.Context, name string) (*model.Role, *model.AppError) {
role, nErr := s.Store.Role().GetByName(ctx, name)
role, nErr := s.Store().Role().GetByName(ctx, name)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -75,7 +75,7 @@ func (a *App) GetRoleByName(ctx context.Context, name string) (*model.Role, *mod
}
func (a *App) GetRolesByNames(names []string) ([]*model.Role, *model.AppError) {
roles, nErr := a.Srv().Store.Role().GetByNames(names)
roles, nErr := a.Srv().Store().Role().GetByNames(names)
if nErr != nil {
return nil, model.NewAppError("GetRolesByNames", "app.role.get_by_names.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
}
@@ -103,7 +103,7 @@ func (s *Server) mergeChannelHigherScopedPermissions(roles []*model.Role) *model
return nil
}
higherScopedPermissionsMap, err := s.Store.Role().ChannelHigherScopedPermissions(higherScopeNamesToQuery)
higherScopedPermissionsMap, err := s.Store().Role().ChannelHigherScopedPermissions(higherScopeNamesToQuery)
if err != nil {
return model.NewAppError("mergeChannelHigherScopedPermissions", "app.role.get_by_names.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
@@ -153,7 +153,7 @@ func (a *App) CreateRole(role *model.Role) (*model.Role, *model.AppError) {
role.SchemeManaged = false
var err error
role, err = a.Srv().Store.Role().Save(role)
role, err = a.Srv().Store().Role().Save(role)
if err != nil {
var invErr *store.ErrInvalidInput
switch {
@@ -168,7 +168,7 @@ func (a *App) CreateRole(role *model.Role) (*model.Role, *model.AppError) {
}
func (a *App) UpdateRole(role *model.Role) (*model.Role, *model.AppError) {
savedRole, err := a.Srv().Store.Role().Save(role)
savedRole, err := a.Srv().Store().Role().Save(role)
if err != nil {
var invErr *store.ErrInvalidInput
switch {
@@ -195,7 +195,7 @@ func (a *App) UpdateRole(role *model.Role) (*model.Role, *model.AppError) {
if utils.StringInSlice(savedRole.Name, builtInChannelRoles) {
roleRetrievalFunc = func() ([]*model.Role, *model.AppError) {
roles, nErr := a.Srv().Store.Role().AllChannelSchemeRoles()
roles, nErr := a.Srv().Store().Role().AllChannelSchemeRoles()
if nErr != nil {
return nil, model.NewAppError("UpdateRole", "app.role.get.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
}
@@ -204,7 +204,7 @@ func (a *App) UpdateRole(role *model.Role) (*model.Role, *model.AppError) {
}
} else {
roleRetrievalFunc = func() ([]*model.Role, *model.AppError) {
roles, nErr := a.Srv().Store.Role().ChannelRolesUnderTeamRole(savedRole.Name)
roles, nErr := a.Srv().Store().Role().ChannelRolesUnderTeamRole(savedRole.Name)
if nErr != nil {
return nil, model.NewAppError("UpdateRole", "app.role.get.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
}