Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ object Sort extends Enum[Sort] with CirceEnum[Sort] {
case object ByLastUpdatedAsc extends Sort("lastUpdated")
case object ByIdDesc extends Sort("-id")
case object ByIdAsc extends Sort("id")
case object ByWidthDesc extends Sort("-width")
case object ByWidthAsc extends Sort("width")
case object ByHeightDesc extends Sort("-height")
case object ByHeightAsc extends Sort("height")

def valueOf(s: String): Option[Sort] = Sort.values.find(_.entryName == s)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ class ImageSearchService(using
case Sort.ByLastUpdatedDesc => fieldSort("lastUpdated").sortOrder(SortOrder.Desc).missing("_last")
case Sort.ByIdAsc => fieldSort("id").sortOrder(SortOrder.Asc).missing("_last")
case Sort.ByIdDesc => fieldSort("id").sortOrder(SortOrder.Desc).missing("_last")
case Sort.ByWidthAsc => fieldSort("imageFiles.dimensions.width")
.sortOrder(SortOrder.Asc)
.missing("_last")
.nested(nestedSort().path("imageFiles"))
case Sort.ByWidthDesc => fieldSort("imageFiles.dimensions.width")
.sortOrder(SortOrder.Desc)
.missing("_last")
.nested(nestedSort().path("imageFiles"))
case Sort.ByHeightAsc => fieldSort("imageFiles.dimensions.height")
.sortOrder(SortOrder.Asc)
.missing("_last")
.nested(nestedSort().path("imageFiles"))
case Sort.ByHeightDesc => fieldSort("imageFiles.dimensions.height")
.sortOrder(SortOrder.Desc)
.missing("_last")
.nested(nestedSort().path("imageFiles"))
}
}

Expand Down