aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/api/query.go2
-rw-r--r--internal/gallery/query.go4
-rw-r--r--internal/gallery/query_photos_test.go4
-rw-r--r--internal/gallery/query_sort.go2
4 files changed, 6 insertions, 6 deletions
diff --git a/internal/api/query.go b/internal/api/query.go
index d79e36a..3468163 100644
--- a/internal/api/query.go
+++ b/internal/api/query.go
@@ -46,7 +46,7 @@ func parseQuery(r *http.Request) (gallery.Query, error) {
if sort := values.Get("sort"); sort != "" {
switch gallery.SortField(sort) {
- case gallery.SortByDateTime, gallery.SortByPath:
+ case gallery.SortByDateTaken, gallery.SortByPath:
query.Sort = gallery.SortField(sort)
default:
return gallery.Query{}, errors.New("invalid sort field")
diff --git a/internal/gallery/query.go b/internal/gallery/query.go
index f528906..e2003d5 100644
--- a/internal/gallery/query.go
+++ b/internal/gallery/query.go
@@ -3,8 +3,8 @@ package gallery
type SortField string
const (
- SortByDateTime SortField = "dateTaken"
- SortByPath SortField = "path"
+ SortByDateTaken SortField = "dateTaken"
+ SortByPath SortField = "path"
)
// SortOrder identifies the sort direction
diff --git a/internal/gallery/query_photos_test.go b/internal/gallery/query_photos_test.go
index 9b190da..c9bb986 100644
--- a/internal/gallery/query_photos_test.go
+++ b/internal/gallery/query_photos_test.go
@@ -214,7 +214,7 @@ func TestQueryPhotosSortByDateAscending(t *testing.T) {
}
got := QueryPhotos(photos, Query{
- Sort: SortByDateTime,
+ Sort: SortByDateTaken,
Order: SortAsc,
})
@@ -244,7 +244,7 @@ func TestQueryPhotosSortByDateDescending(t *testing.T) {
}
got := QueryPhotos(photos, Query{
- Sort: SortByDateTime,
+ Sort: SortByDateTaken,
Order: SortDesc,
})
diff --git a/internal/gallery/query_sort.go b/internal/gallery/query_sort.go
index 7ad811b..1a3a63c 100644
--- a/internal/gallery/query_sort.go
+++ b/internal/gallery/query_sort.go
@@ -18,7 +18,7 @@ func sortQueryPhotos(
}
return photos[i].RelativePath < photos[j].RelativePath
- case SortByDateTime:
+ case SortByDateTaken:
if query.Order == SortAsc {
if !photos[i].DateTaken.Equal(photos[j].DateTaken) {
return photos[i].DateTaken.Before(photos[j].DateTaken)