MM-15289 Migrate command.GetByTeam to sync by default (#10740)

Этот коммит содержится в:
Puneeth Reddy
2019-04-29 01:20:52 -07:00
коммит произвёл Jesús Espino
родитель 214e9d2ae0
Коммит 171058eb3d
6 изменённых файлов: 43 добавлений и 46 удалений

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

@@ -76,16 +76,14 @@ func (s SqlCommandStore) Get(id string) store.StoreChannel {
})
}
func (s SqlCommandStore) GetByTeam(teamId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
var commands []*model.Command
func (s SqlCommandStore) GetByTeam(teamId string) ([]*model.Command, *model.AppError) {
var commands []*model.Command
if _, err := s.GetReplica().Select(&commands, "SELECT * FROM Commands WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId}); err != nil {
result.Err = model.NewAppError("SqlCommandStore.GetByTeam", "store.sql_command.save.get_team.app_error", nil, "teamId="+teamId+", err="+err.Error(), http.StatusInternalServerError)
}
if _, err := s.GetReplica().Select(&commands, "SELECT * FROM Commands WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId}); err != nil {
return nil, model.NewAppError("SqlCommandStore.GetByTeam", "store.sql_command.save.get_team.app_error", nil, "teamId="+teamId+", err="+err.Error(), http.StatusInternalServerError)
}
result.Data = commands
})
return commands, nil
}
func (s SqlCommandStore) GetByTrigger(teamId string, trigger string) store.StoreChannel {