MM-16780 Migrate "Team.AnalyticsGetTeamCountForScheme" to Sync by default (#11588)

* Changed the implementation of AnalyticsGetTeamCountForScheme to sync

* Updated the Store interface

* Updated the AnalyticsGetTeamCountForScheme tests

* Updated the autogenerated mocks

* Updated trackPermissions to use the modified method
Этот коммит содержится в:
Tim Scheuermann
2019-07-17 01:10:30 +02:00
коммит произвёл Jesús Espino
родитель 1cb32b2331
Коммит 1da858ac4c
5 изменённых файлов: 32 добавлений и 25 удалений

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

@@ -940,15 +940,13 @@ func (s SqlTeamStore) ClearAllCustomRoleAssignments() *model.AppError {
return nil
}
func (s SqlTeamStore) AnalyticsGetTeamCountForScheme(schemeId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
count, err := s.GetReplica().SelectInt("SELECT count(*) FROM Teams WHERE SchemeId = :SchemeId AND DeleteAt = 0", map[string]interface{}{"SchemeId": schemeId})
if err != nil {
result.Err = model.NewAppError("SqlTeamStore.AnalyticsGetTeamCountForScheme", "store.sql_team.analytics_get_team_count_for_scheme.app_error", nil, "schemeId="+schemeId+" "+err.Error(), http.StatusInternalServerError)
return
}
result.Data = count
})
func (s SqlTeamStore) AnalyticsGetTeamCountForScheme(schemeId string) (int64, *model.AppError) {
count, err := s.GetReplica().SelectInt("SELECT count(*) FROM Teams WHERE SchemeId = :SchemeId AND DeleteAt = 0", map[string]interface{}{"SchemeId": schemeId})
if err != nil {
return 0, model.NewAppError("SqlTeamStore.AnalyticsGetTeamCountForScheme", "store.sql_team.analytics_get_team_count_for_scheme.app_error", nil, "schemeId="+schemeId+" "+err.Error(), http.StatusInternalServerError)
}
return count, nil
}
func (s SqlTeamStore) GetAllForExportAfter(limit int, afterId string) ([]*model.TeamForExport, *model.AppError) {