Adding loc to new command backend

Этот коммит содержится в:
=Corey Hulen
2016-02-01 18:52:43 -08:00
родитель b4ec690051
Коммит 27586a320a
12 изменённых файлов: 297 добавлений и 276 удалений

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

@@ -47,8 +47,7 @@ func (s SqlCommandStore) Save(command *model.Command) StoreChannel {
result := StoreResult{}
if len(command.Id) > 0 {
result.Err = model.NewAppError("SqlCommandStore.Save",
"You cannot overwrite an existing Command", "id="+command.Id)
result.Err = model.NewLocAppError("SqlCommandStore.Save", "store.sql_command.save.saving_overwrite.app_error", nil, "id="+command.Id)
storeChannel <- result
close(storeChannel)
return
@@ -62,7 +61,7 @@ func (s SqlCommandStore) Save(command *model.Command) StoreChannel {
}
if err := s.GetMaster().Insert(command); err != nil {
result.Err = model.NewAppError("SqlCommandStore.Save", "We couldn't save the Command", "id="+command.Id+", "+err.Error())
result.Err = model.NewLocAppError("SqlCommandStore.Save", "store.sql_command.save.saving.app_error", nil, "id="+command.Id+", "+err.Error())
} else {
result.Data = command
}
@@ -83,7 +82,7 @@ func (s SqlCommandStore) Get(id string) StoreChannel {
var command model.Command
if err := s.GetReplica().SelectOne(&command, "SELECT * FROM Commands WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id}); err != nil {
result.Err = model.NewAppError("SqlCommandStore.Get", "We couldn't get the command", "id="+id+", err="+err.Error())
result.Err = model.NewLocAppError("SqlCommandStore.Get", "store.sql_command.save.get.app_error", nil, "id="+id+", err="+err.Error())
}
result.Data = &command
@@ -104,7 +103,7 @@ func (s SqlCommandStore) GetByTeam(teamId string) StoreChannel {
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", "We couldn't get the commands", "teamId="+teamId+", err="+err.Error())
result.Err = model.NewLocAppError("SqlCommandStore.GetByTeam", "store.sql_command.save.get_team.app_error", nil, "teamId="+teamId+", err="+err.Error())
}
result.Data = commands
@@ -124,7 +123,7 @@ func (s SqlCommandStore) Delete(commandId string, time int64) StoreChannel {
_, err := s.GetMaster().Exec("Update Commands SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": commandId})
if err != nil {
result.Err = model.NewAppError("SqlCommandStore.Delete", "We couldn't delete the command", "id="+commandId+", err="+err.Error())
result.Err = model.NewLocAppError("SqlCommandStore.Delete", "store.sql_command.save.delete.app_error", nil, "id="+commandId+", err="+err.Error())
}
storeChannel <- result
@@ -142,7 +141,7 @@ func (s SqlCommandStore) PermanentDeleteByUser(userId string) StoreChannel {
_, err := s.GetMaster().Exec("DELETE FROM Commands WHERE CreatorId = :UserId", map[string]interface{}{"UserId": userId})
if err != nil {
result.Err = model.NewAppError("SqlCommandStore.DeleteByUser", "We couldn't delete the command", "id="+userId+", err="+err.Error())
result.Err = model.NewLocAppError("SqlCommandStore.DeleteByUser", "store.sql_command.save.delete_perm.app_error", nil, "id="+userId+", err="+err.Error())
}
storeChannel <- result
@@ -161,7 +160,7 @@ func (s SqlCommandStore) Update(hook *model.Command) StoreChannel {
hook.UpdateAt = model.GetMillis()
if _, err := s.GetMaster().Update(hook); err != nil {
result.Err = model.NewAppError("SqlCommandStore.Update", "We couldn't update the command", "id="+hook.Id+", "+err.Error())
result.Err = model.NewLocAppError("SqlCommandStore.Update", "store.sql_command.save.update.app_error", nil, "id="+hook.Id+", "+err.Error())
} else {
result.Data = hook
}