Don't sort ReadAll translations, as it will be sorted in the UI

This commit is contained in:
Deluan
2020-05-02 12:37:32 -04:00
committed by Deluan Quintão
parent 496b467c1d
commit 854a923fea
+1 -5
View File
@@ -5,7 +5,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"path/filepath" "path/filepath"
"sort"
"strings" "strings"
"sync" "sync"
@@ -48,16 +47,13 @@ func (r *translationRepository) Count(options ...rest.QueryOptions) (int64, erro
return int64(len(translations)), nil return int64(len(translations)), nil
} }
// Simple ReadAll implementation, only returns IDs. Does not support any `options`, always sort by name asc // Simple ReadAll implementation, only returns IDs. Does not support any `options`
func (r *translationRepository) ReadAll(options ...rest.QueryOptions) (interface{}, error) { func (r *translationRepository) ReadAll(options ...rest.QueryOptions) (interface{}, error) {
var result []translation var result []translation
for _, t := range translations { for _, t := range translations {
t.Data = "" t.Data = ""
result = append(result, t) result = append(result, t)
} }
sort.Slice(result, func(i, j int) bool {
return result[i].Name < result[j].Name
})
return result, nil return result, nil
} }